Created
August 14, 2019 07:58
-
-
Save jiren/2d6dec5b42f9c8559837339c3b0232e7 to your computer and use it in GitHub Desktop.
Google cloud storage upload issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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