0.4.0 • Published 1 year ago

@gasstack/fs v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@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

0.3.0

1 year ago

0.4.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago