1 | import { BlobParse, BufferParse, CacheNever, JSONParse, TextParse } from "@pnp/queryable/index.js";
|
2 | import { _SPInstance, SPQueryable } from "../spqueryable.js";
|
3 | export class ReadableFile extends _SPInstance {
|
4 | /**
|
5 | * Gets the contents of the file as text. Not supported in batching.
|
6 | *
|
7 | */
|
8 | getText() {
|
9 | return this.getParsed(TextParse());
|
10 | }
|
11 | /**
|
12 | * Gets the contents of the file as a blob, does not work in Node.js. Not supported in batching.
|
13 | *
|
14 | */
|
15 | getBlob() {
|
16 | return this.getParsed(BlobParse());
|
17 | }
|
18 | /**
|
19 | * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.
|
20 | */
|
21 | getBuffer() {
|
22 | return this.getParsed(BufferParse());
|
23 | }
|
24 | /**
|
25 | * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.
|
26 | */
|
27 | getJSON() {
|
28 | return this.getParsed(JSONParse());
|
29 | }
|
30 | getParsed(parser) {
|
31 | return SPQueryable(this, "$value").using(parser, CacheNever())();
|
32 | }
|
33 | }
|
34 | //# sourceMappingURL=readable-file.js.map |
\ | No newline at end of file |