Saving files to cloud storage from memory
Eg saving a json
docs
File - Documentation
1
const bucket = admin.storage().bucket(testEnv.storageBucket);
2
const file = bucket.file(mockObject.name);
3
const contents = JSON.stringify(mockObject, null, 2);
4
​
5
file.save(contents, function(err) {
6
if (!err) {
7
// file written
8
}
9
});
Copied!
uploading buffer or string Β· Issue #2334 Β· googleapis/google-cloud-node
GitHub
​
Last modified 8mo ago
Copy link