Stay organized with collections Save and categorize content based on your preferences.
BlobA data interchange object for Apps Script services.
Methods Deprecated methods Method Return type Brief descriptiongetAllBlobs()
Blob[]
Gets all the blobs that are contained within this (possibly composite) blob. Detailed documentation copyBlob()
Returns a copy of this blob.
ReturnBlob
— The new copy.
getAs(contentType)
Return the data inside this object as a blob converted to the specified content type. This method adds the appropriate extension to the filename—for example, "myfile.pdf". However, it assumes that the part of the filename that follows the last period (if any) is an existing extension that should be replaced. Consequently, "ShoppingList.12.25.2014" becomes "ShoppingList.12.25.pdf".
To view the daily quotas for conversions, see Quotas for Google Services. Newly created Google Workspace domains might be temporarily subject to stricter quotas.
Parameters Name Type DescriptioncontentType
String
The MIME type to convert to. For most blobs, 'application/pdf'
is the only valid option. For images in BMP, GIF, JPEG, or PNG format, any of 'image/bmp'
, 'image/gif'
, 'image/jpeg'
, or 'image/png'
are also valid. For a Google Docs document, 'text/markdown'
is also valid. Return
Blob
— The data as a blob.
getBytes()
Gets the data stored in this blob.
ReturnByte[]
— The stored bytes.
getContentType()
Gets the content type of the bytes in this blob.
ReturnString
— The content type of this data, if known, or null
.
getDataAsString()
Gets the data of this blob as a String with UTF-8 encoding.
ReturnString
— The data as a string.
getDataAsString(charset)
Gets the data of this blob as a string with the specified encoding.
Parameters Name Type Descriptioncharset
String
The charset to use in encoding the data in this blob as a string. Return
String
— The data as a string.
getName()
Gets the name of this blob.
ReturnString
— The name of this data, if known, or null
.
isGoogleType()
Returns whether this blob is a Google Workspace file (Sheets, Docs, etc.).
ReturnBoolean
— true
if this blob is a Google Workspace file; false
if not.
setBytes(data)
Sets the data stored in this blob.
Parameters Name Type Descriptiondata
Byte[]
The new data. Return
Blob
— This blob, for chaining.
setContentType(contentType)
Sets the content type of the bytes in this blob.
Parameters Name Type DescriptioncontentType
String
The new contentType. Return
Blob
— This blob, for chaining.
setContentTypeFromExtension()
Sets the content type of the bytes in this blob based on the file extension. The contentType is null
if it cannot be guessed from its extension.
Blob
— This blob, for chaining.
setDataFromString(string)
Sets the data of this blob from a string with UTF-8 encoding.
Parameters Name Type Descriptionstring
String
The string data. Return
Blob
— This blob, for chaining.
setDataFromString(string, charset)
Sets the data of this blob from a string with the specified encoding.
Parameters Name Type Descriptionstring
String
The string data. charset
String
The charset to use in interpreting the string as bytes. Return
Blob
— This blob, for chaining.
setName(name)
Sets the name of this blob.
Parameters Name Type Descriptionname
String
The new name. Return
Blob
— This blob, for chaining.
getAllBlobs()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets all the blobs that are contained within this (possibly composite) blob.
ReturnBlob[]
— The blobs contained within the blob.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["A Blob is a data interchange object used for storing and manipulating binary data within Apps Script services."],["Blobs provide methods for setting, getting, and converting data in various formats, including bytes, strings, and specific content types."],["It allows manipulation of data content, type, and name using dedicated methods."],["Blobs can handle Google Workspace files and offer functionalities for managing them within Apps Script."],["The `getAllBlobs()` method is deprecated and should not be used in new scripts."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4