browser-fs-access
Advanced tools
Comparing version 0.28.1 to 0.29.0
@@ -139,3 +139,3 @@ /** | ||
/** To-be-saved `Blob` or `Response` */ | ||
blobOrResponse: Blob | Response, | ||
blobOrResponse: Blob | Response | Promise<Blob>, | ||
options?: [FirstFileSaveOptions, ...CoreFileOptions[]] | FirstFileSaveOptions, | ||
@@ -142,0 +142,0 @@ /** |
{ | ||
"name": "browser-fs-access", | ||
"version": "0.28.1", | ||
"version": "0.29.0", | ||
"description": "File System Access API with legacy fallback in the browser.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -82,2 +82,17 @@ # Browser-FS-Access | ||
}); | ||
// Save a `Response` that will be streamed. | ||
const response = await fetch('foo.png'); | ||
await fileSave(response, { | ||
fileName: 'foo.png', | ||
extensions: ['.png'], | ||
}); | ||
// Save a `<Promise>Blob` that will be streamed. | ||
// No need to `await` the `Blob` to be created. | ||
const blob = createBlobAsyncWhichMightTakeLonger(someData); | ||
await fileSave(response, { | ||
fileName: 'Untitled.png', | ||
extensions: ['.png'], | ||
}); | ||
})(); | ||
@@ -161,3 +176,9 @@ ``` | ||
await fileSave(someBlob, options, existingHandle, throwIfExistingHandleNotGood); | ||
// `blobOrPromiseBlobOrResponse` is a `Blob`, a `<Promise>Blob`, or a `Response`. | ||
await fileSave( | ||
blobOrResponseOrPromiseBlob, | ||
options, | ||
existingHandle, | ||
throwIfExistingHandleNotGood | ||
); | ||
``` | ||
@@ -181,2 +202,6 @@ | ||
It also powers the [SVGcode](https://svgco.de/) app that converts raster images to SVGs. | ||
![svgcode](https://github.com/tomayac/SVGcode/raw/main/public/screenshots/desktop.png) | ||
## Alternatives | ||
@@ -209,2 +234,3 @@ | ||
[@jmrog](https://github.com/jmrog). | ||
The streams and blob saving was improved by [@tmcw](https://github.com/tmcw). | ||
@@ -211,0 +237,0 @@ ## License and Note |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
44878
292
238