Issue with image assets not showing up in Sanity Studio CMS or front end after bulk downloading and optimizing dataset.
2 replies
Last updated: Nov 26, 2021
A
Hi, I am try to bulk download .tar.gz of dataset in sanity and optimized the images manually (the images folder) without renaming any files. Then I repacked the folder as .tar.gz (same folder structure with asset.json and data.jsonld and images folder). I have been trying for a while now, but the issue is that when I import to new dataset the image assets aren't showing up in sanity studio cms or the front end. But i do see the images in the media gallery plugin inside sanity, as well as via graphql on the main dataset
Nov 25, 2021, 4:04 PM
A
Hi, could someone help please. I am trying to launch today
else if(typeof val === 'undefined' || val == null) {
return val
}
else if(typeof val === 'boolean' || typeof val === 'number') {
return val
}
else {
return val
}
}
(async ()=> {
let data = await new Promise((resolve)=> {
let temp = []
fs.createReadStream('./data.ndjson')
.pipe(ndjson.parse())
.on('data', function(obj) {
temp.push(obj)
})
.on('end', function() {
resolve(temp)
})
})
let writeStream = fs.createWriteStream('./output_0.ndjson')
const serialize = ndjson.stringify()
serialize.on('data', function(line) {
// line is line of stringified JSON with newline delimiter the end
writeStream.write(line, 'utf-8')
})
writeStream.on('finish', () => {
console.log('wrote all data to file')
})
data = data.forEach((item)=> {
let newItem = {
...item
}
newItem = rebuildFileAssetUrls(newItem)
serialize.write(newItem)
})
serialize.end()
})()
leaving this script here for anyone who have this problem again.
for this "amazing" community of 13 K members ! thank you very much!!!!
Nov 26, 2021, 3:55 PM
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.