dat-glob
Glob implementation for dat archives
Last updated a year ago by savelbr .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dat-glob 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.3.0                                ...           latest (a year ago)

7 Versions

  • 1.3.0                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (4)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |