Created
November 1, 2021 17:11
-
-
Save shaffeeullah/d3e755ffeb18196adcaf5d51f82f2d32 to your computer and use it in GitHub Desktop.
Used createReadStream to read data from a Cloud Storage file
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
app.get('/', async (req, res) => { | |
const bucket = storage.bucket(bucketName); | |
const file = bucket.file(fileName); | |
const readStream = file.createReadStream(); | |
//Pipe data from the read-stream into the HTTP response body | |
readStream.pipe(res); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment