UNPKG

@pnp/sp

Version:

pnp - provides a fluent api for working with SharePoint REST

34 lines 1.07 kB
import { BlobParse, BufferParse, CacheNever, JSONParse, TextParse } from "@pnp/queryable/index.js"; import { _SPInstance, SPQueryable } from "../spqueryable.js"; export class ReadableFile extends _SPInstance { /** * Gets the contents of the file as text. Not supported in batching. * */ getText() { return this.getParsed(TextParse()); } /** * Gets the contents of the file as a blob, does not work in Node.js. Not supported in batching. * */ getBlob() { return this.getParsed(BlobParse()); } /** * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching. */ getBuffer() { return this.getParsed(BufferParse()); } /** * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching. */ getJSON() { return this.getParsed(JSONParse()); } getParsed(parser) { return SPQueryable(this, "$value").using(parser, CacheNever())(); } } //# sourceMappingURL=readable-file.js.map