google-cloud-node: options.public to storage/File.createWriteStream doesn't make uploaded files public
According to API docs, storage/File.createWriteStream
should take a boolean option public
that makes the uploaded file publicly readable. However, in my experience this isn’t the case.
I create the stream like this:
let cloudFileStream = cloudFile.createWriteStream({
public: true,
resumable: false,
})
And still, I have to call cloudFile.makePublic
after the upload has finished, because otherwise the file is only accessible to the owner:
cloudFileStream
.on('finish', () => {
cloudFile.makePublic()
})
Environment details
- OS: OS X El Capitan
- Node.js version: 6.4.0
- npm version: 3.10.6
- google-cloud-node version: 0.39.0
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 17 (15 by maintainers)
We do: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/35573c31e834c841b99ae73f6cf5e647b76ae7cc/packages/storage/system-test/storage.js#L424 – but if we’re not doing it the right way, we’ll need to rewrite the test.
I would like to resolve this the right way once and for all! I’m going to need some help from @jgeewax, @omaray, maybe @capstan. Simply put, what needs to be in an upload request body that makes the file being uploaded public? Thanks!
@stephenplusplus OK, so that should mean that
predefinedAcl: publicRead
is equivalent to callingfile.makePublic()
does it not? I end up with the same in my file permissions, by callingfile.makePublic()
.@stephenplusplus How did you add the
allusers: Reader
bit? Does this correspond topredefinedAcl: publicRead
?