Reference documentation and code samples for the Cloud Storage Client class WriteStream.
A Stream implementation that uploads in chunks to a provided uploader when
we reach a certain chunkSize. Uponclose, we will upload the remaining chunk.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Storage Client - Class WriteStream (1.48.3)\n\nVersion latestkeyboard_arrow_down\n\n- [1.48.3 (latest)](/php/docs/reference/cloud-storage/latest/WriteStream)\n- [1.48.2](/php/docs/reference/cloud-storage/1.48.2/WriteStream)\n- [1.47.0](/php/docs/reference/cloud-storage/1.47.0/WriteStream)\n- [1.46.0](/php/docs/reference/cloud-storage/1.46.0/WriteStream)\n- [1.45.0](/php/docs/reference/cloud-storage/1.45.0/WriteStream)\n- [1.44.0](/php/docs/reference/cloud-storage/1.44.0/WriteStream)\n- [1.43.1](/php/docs/reference/cloud-storage/1.43.1/WriteStream)\n- [1.42.1](/php/docs/reference/cloud-storage/1.42.1/WriteStream)\n- [1.41.4](/php/docs/reference/cloud-storage/1.41.4/WriteStream)\n- [1.37.0](/php/docs/reference/cloud-storage/1.37.0/WriteStream)\n- [1.36.1](/php/docs/reference/cloud-storage/1.36.1/WriteStream)\n- [1.35.0](/php/docs/reference/cloud-storage/1.35.0/WriteStream)\n- [1.34.0](/php/docs/reference/cloud-storage/1.34.0/WriteStream)\n- [1.33.4](/php/docs/reference/cloud-storage/1.33.4/WriteStream)\n- [1.32.0](/php/docs/reference/cloud-storage/1.32.0/WriteStream)\n- [1.31.2](/php/docs/reference/cloud-storage/1.31.2/WriteStream)\n- [1.30.3](/php/docs/reference/cloud-storage/1.30.3/WriteStream) \nReference documentation and code samples for the Cloud Storage Client class WriteStream.\n\nA Stream implementation that uploads in chunks to a provided uploader when\nwe reach a certain chunkSize. Upon `close`, we will upload the remaining chunk.\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Storage\n\nMethods\n-------\n\n### __construct\n\nCreate a new WriteStream instance\n\n### close\n\nClose the stream. Uploads any remaining data.\n\n### write\n\nWrite to the stream. If we pass the chunkable size, upload the available chunk.\n\n### setUploader\n\nSet the uploader for this class. You may need to set this after initialization\nif the uploader depends on this stream."]]