You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-2
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,10 @@ It allows you to easily create [Blob](https://developer.mozilla.org/en-US/docs/W
6
6
7
7
## Features
8
8
9
+
- Deferred loading of blob/file contents to minimize memory usage
9
10
-`LazyBlob extends Blob` and `LazyFile extends File` so instances can be used anywhere you'd normally expect a regular `Blob`/`File`
10
11
- Accepts all the same content types as the original [`Blob()`](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob) and [`File()`](https://developer.mozilla.org/en-US/docs/Web/API/File/File) constructors
11
12
- Supports [`Blob.slice()`](https://developer.mozilla.org/en-US/docs/Web/API/Blob/slice), even on streaming content
12
-
- Memory efficient!
13
13
14
14
## The Problem
15
15
@@ -19,7 +19,16 @@ JavaScript's [File API](https://developer.mozilla.org/en-US/docs/Web/API/File) i
19
19
let file =newFile(["hello world"], "hello.txt", { type: "text/plain" });
20
20
```
21
21
22
-
A `LazyFile` improves this model by accepting an additional content type in its constructor: `LazyContent`. All other `File` functionality works as you'd expect.
22
+
A `LazyFile` improves this model by accepting an additional content type in its constructor: `LazyContent`.
23
+
24
+
```ts
25
+
let lazyContent:LazyContent= {
26
+
/* See below for usage */
27
+
};
28
+
let file =newFile(lazyContent, "hello.txt", { type: "text/plain" });
29
+
```
30
+
31
+
All other `File` functionality works as you'd expect.
0 commit comments