@gasstack/fs
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

@gasstack/fs

The package is meant to ease the useage of the Google App Script DriveApp functionalities.

Description

The package allows to explore folders and files using arrays and operators instead of iterators and verbose callback-based method calls.

Usage

It is possible to implement filtering with array functions

const recentFilesSize = getFiles("<folder id>")
  .filter((p) => p.getLastUpdated() < 7 * 24 * 60 * 60 * 1000)
  .reduce((acc, p) => acc + p.getSize());

It is also possible to use an base iterator to implement cursor based pagination:

const filesIterator = DriveApp.getFolderById("<folder id>").getFiles();

let page = fromDriveIterator(filesIterator, 10);

page = continueFiles(filesIterator.getContinuationToken(), 10);

Example

Have a look to the e2e test.

API

API Reference

Package Sidebar

Install

npm i @gasstack/fs

Weekly Downloads

8

Version

0.4.0

License

MIT

Unpacked Size

7.22 kB

Total Files

5

Last publish

Collaborators

  • gcanossa