Spaces:
Sleeping
Sleeping
Download replace_urls.cjs from Shivam4096/Carpool: direct link, hf CLI and curl.
- Browser
- Download file 712 Bytes
-
https://huggingface.co/spaces/Shivam4096/Carpool/resolve/main/replace_urls.cjs
- Command line
-
hf download hf://spaces/Shivam4096/Carpool/replace_urls.cjs
-
curl -L -o replace_urls.cjs https://huggingface.co/spaces/Shivam4096/Carpool/resolve/main/replace_urls.cjs
712 Bytes
| const fs = require('fs'); | |
| const path = require('path'); | |
| const dir = 'C:/LLM/carpool/src'; | |
| const files = fs.readdirSync(dir).filter(f => f.endsWith('.jsx')); | |
| let totalReplaced = 0; | |
| files.forEach(f => { | |
| const p = path.join(dir, f); | |
| let c = fs.readFileSync(p, 'utf8'); | |
| // Replace http://${window.location.hostname}:3001/api with /api | |
| // We match the exact template literal string usage or regular string usage | |
| const targetPattern = /http:\/\/\$\{window\.location\.hostname\}:3001/g; | |
| if (targetPattern.test(c)) { | |
| c = c.replace(targetPattern, ''); | |
| fs.writeFileSync(p, c); | |
| console.log('Updated ' + f); | |
| totalReplaced++; | |
| } | |
| }); | |
| console.log('Total files updated: ' + totalReplaced); | |