JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q38378F
  • License Apache-2.0

Glob implementation for dat archives

Package Exports

  • dat-glob
  • dat-glob/stream

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dat-glob) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dat-glob

Glob implementation for dat archives.

Supports both raw hyperdrive instances and Beaker Browser's DatArchive API.

Usage

This package exports two modules. The default require('dat-glob') works with async iteration, whereas require('dat-glob/stream') uses standard Node streams. Both modules include a collect method which returns a list of all matching files.

// Async iteration
var glob = require('dat-glob')

async function main () {
  var dat = await DatArchive.create()

  for await (var file of glob(dat, '**/*.json')) {
    console.log(file) // 'dat.json'
  }

  var files = await glob(dat, '**/*.json').collect()
  console.log(files) // ['dat.json']
}

main()

// Node stream
var hyperdrive = require('hyperdrive')
var glob = require('dat-glob/stream')

var dat = hyperdrive(key)
var stream = glob(dat, ['*.json', 'subdir/*.json'])

stream.pipe(process.stdout)

stream.collect((err, files) => {
  console.log(files)
})

License

Apache-2.0