sajaniemi_variable_dataset_large / pool /shard004 /JavaScript /0025221_generate-images-json.js
Pendigard's picture
Upload folder using huggingface_hub (part 53)
7e79d67 verified
Raw History Blame Contribute Delete
529 Bytes
const join = require('path').join
const glob = require('glob')
const fs = require('fs')
const jsonPath = join(__dirname, '../src/background-images.json')
glob(join(__dirname, '../public/assets/images/background/*.jpg'), (err, paths) => {
if (err) throw err
let publicPaths = []
publicPaths = paths.map((path) => path.replace(/.*?public/, ''))
fs.writeFile(jsonPath, JSON.stringify(publicPaths), 'utf8', (err) => {
if (err) throw err
console.log(`Images JSON saved to: ${jsonPath}`)
process.exit(0)
})
})