Skip to main content
openAsBlob - node__fs.d.ts - Node documentation
function openAsBlob
Unstable

Usage in Deno

```typescript import { openAsBlob } from "node:node__fs.d.ts"; ```
openAsBlob(
path: PathLike,
): Promise<Blob>
Returns a `Blob` whose data is backed by the given file. The file must not be modified after the `Blob` is created. Any modifications will cause reading the `Blob` data to fail with a `DOMException` error. Synchronous stat operations on the file when the `Blob` is created, and before each read in order to detect whether the file data has been modified on disk. ```js import { openAsBlob } from 'node:fs'; const blob = await openAsBlob('the.file.txt'); const ab = await blob.arrayBuffer(); blob.stream(); ```

Parameters

path: PathLike
optional
options: OpenAsBlobOptions

Return Type

Promise<Blob>