### Install file64 with npm Source: https://encrypit.github.io/file64/index.html Install the file64 library using npm. This is the standard package manager for Node.js. ```bash npm install file64 ``` -------------------------------- ### Install file64 with Yarn Source: https://encrypit.github.io/file64/index.html Install the file64 library using Yarn. Yarn is an alternative package manager for JavaScript. ```bash yarn add file64 ``` -------------------------------- ### Convert Base64 to File Source: https://encrypit.github.io/file64/index.html Use the `base64ToFile` function to convert a Base64 encoded string into a File object. You must provide a filename as the second argument. ```javascript import { base64ToFile } from 'file64'; const file = await base64ToFile('data:text/plain;base64,YQ==', 'file.txt'); ``` -------------------------------- ### Convert File to Base64 Source: https://encrypit.github.io/file64/index.html Use the `fileToBase64` function to convert a File object into a Base64 encoded string. This is commonly used when working with user-uploaded files. ```javascript import { fileToBase64 } from 'file64'; const file = new File(['a'], 'file.txt', { type: 'text/plain' }); const base64 = await fileToBase64(file); ``` -------------------------------- ### Convert Base64 to Blob Source: https://encrypit.github.io/file64/index.html Use the `base64ToBlob` function to convert a Base64 encoded string into a Blob object. Ensure the input string is a valid data URL. ```javascript import { base64ToBlob } from 'file64'; const blob = await base64ToBlob('data:text/plain;base64,YQ=='); ``` -------------------------------- ### base64ToFile Source: https://encrypit.github.io/file64/functions/base64ToFile.html Converts a Base64 encoded string into a File object. This function is useful for handling file uploads or data that has been encoded as Base64. ```APIDOC ## Function base64ToFile ### Description Converts Base64 to File. ### Signature `base64ToFile(base64: string, filename: string, options?: FilePropertyBag): Promise` ### Parameters #### Path Parameters * **base64** (string) - Required - The Base64 encoded string. * **filename** (string) - Required - The desired name for the file. * **options** (FilePropertyBag) - Optional - Additional options for the file, such as MIME type. ### Returns * **Promise** - A Promise that resolves with the created File object. ``` -------------------------------- ### Convert Blob to Base64 Source: https://encrypit.github.io/file64/index.html Use the `blobToBase64` function to convert a Blob object into a Base64 encoded string. This is useful for uploading or storing binary data. ```javascript import { blobToBase64 } from 'file64'; const blob = new Blob(['a'], { type: 'text/plain' }); const base64 = await blobToBase64(blob); ``` -------------------------------- ### base64ToBlob Source: https://encrypit.github.io/file64/functions/base64ToBlob.html Converts a Base64 encoded string into a Blob object. This is useful for handling binary data that has been encoded as a string. ```APIDOC ## base64ToBlob ### Description Converts Base64 to Blob. ### Method N/A (SDK Function) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Parameters #### base64 - **base64** (string) - Required - The Base64 encoded string to convert. ### Returns Promise #### Success Response - **Blob** (Blob) - The resulting Blob object. ### Response Example N/A (SDK Function) ### Error Handling N/A ``` -------------------------------- ### blobToBase64 Source: https://encrypit.github.io/file64/functions/blobToBase64.html Converts a Blob object into a Base64 encoded string. This is useful for handling binary data in web applications. ```APIDOC ## blobToBase64 ### Description Converts a Blob object to its Base64 string representation. ### Method `blobToBase64(blob: Blob): Promise` ### Parameters #### Path Parameters * **blob** (Blob) - Required - The Blob object to convert. ### Returns * **Promise** - A promise that resolves with the Base64 encoded string of the Blob. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.