Skip to content

Instantly share code, notes, and snippets.

@jiren
Created August 14, 2019 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiren/2d6dec5b42f9c8559837339c3b0232e7 to your computer and use it in GitHub Desktop.
Save jiren/2d6dec5b42f9c8559837339c3b0232e7 to your computer and use it in GitHub Desktop.
Google cloud storage upload issue
const {Storage} = require('@google-cloud/storage')
const storage = new Storage();
const bucket = storage.bucket('fe-store');
async function upload() {
const largeCustomMeta = () => {
let str = '';
for (let i = 0; i < 2.1e6; i++) {
str += 'a';
}
return str;
};
const file = bucket.file('1.txt');
await file.save('test data', {
metadata: {
metadata: {
custom: largeCustomMeta(),
},
},
});
}
(async () => {
try {
await upload();
} catch (err) {
console.log(err);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment