Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datastore-fs

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datastore-fs - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

dist/src/index.d.ts

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# [3.0.0](https://github.com/ipfs/js-datastore-fs/compare/v2.0.2...v3.0.0) (2021-01-22)
### Features
* types ([#62](https://github.com/ipfs/js-datastore-fs/issues/62)) ([de519dd](https://github.com/ipfs/js-datastore-fs/commit/de519dd6b8c0b892e827fb2d26cde3239358eaf6))
## [2.0.2](https://github.com/ipfs/js-datastore-fs/compare/v2.0.1...v2.0.2) (2020-11-09)

@@ -2,0 +11,0 @@

23

package.json
{
"name": "datastore-fs",
"version": "2.0.2",
"version": "3.0.0",
"description": "Datastore implementation with file system backend",
"leadMaintainer": "Alex Potsides <alex.potsides@protocol.ai>",
"main": "src/index.js",
"types": "dist/src/index.d.ts",
"files": [
"src",
"dist"
],
"scripts": {
"prepare": "aegir build --no-bundle",
"test": "aegir test -t node",

@@ -35,5 +41,5 @@ "build": "aegir build",

"dependencies": {
"datastore-core": "^2.0.0",
"datastore-core": "^3.0.0",
"fast-write-atomic": "^0.2.0",
"interface-datastore": "^2.0.0",
"interface-datastore": "^3.0.3",
"it-glob": "0.0.10",

@@ -43,10 +49,13 @@ "mkdirp": "^1.0.4"

"devDependencies": {
"aegir": "^28.1.0",
"aegir": "^30.3.0",
"async-iterator-all": "^1.0.0",
"cids": "^1.0.0",
"cids": "^1.1.5",
"detect-node": "^2.0.4",
"ipfs-utils": "^4.0.1",
"ipfs-utils": "^6.0.0",
"memdown": "^5.1.0",
"rimraf": "^3.0.2"
},
"eslintConfig": {
"extends": "ipfs"
},
"contributors": [

@@ -57,5 +66,5 @@ "achingbrain <alex@achingbrain.net>",

"Jacob Heun <jacobheun@gmail.com>",
"Hugo Dias <hugomrdias@gmail.com>",
"Pedro Teixeira <i@pgte.me>",
"Hector Sanjuan <code@hector.link>",
"Hugo Dias <hugomrdias@gmail.com>",
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>",

@@ -62,0 +71,0 @@ "Richard Schneider <makaretu@gmail.com>",

@@ -5,4 +5,6 @@ 'use strict'

const glob = require('it-glob')
// @ts-ignore
const mkdirp = require('mkdirp')
const promisify = require('util').promisify
// @ts-ignore
const writeAtomic = promisify(require('fast-write-atomic'))

@@ -21,2 +23,14 @@ const path = require('path')

/**
* @typedef {import('interface-datastore').Datastore} Datastore
* @typedef {import('interface-datastore').Pair} Pair
* @typedef {import('interface-datastore').Query} Query
*/
/**
* Write a file atomically
*
* @param {string} path
* @param {Uint8Array} contents
*/
async function writeFile (path, contents) {

@@ -47,4 +61,10 @@ try {

* to the file system as is.
*
* @implements {Datastore}
*/
class FsDatastore extends Adapter {
/**
* @param {string} location
* @param {{ createIfMissing?: boolean; errorIfExists?: boolean; extension?: string; } | undefined} [opts]
*/
constructor (location, opts) {

@@ -70,6 +90,7 @@ super()

}
return Promise.resolve()
} catch (err) {
if (err.code === 'ERR_NOT_FOUND' && this.opts.createIfMissing) {
mkdirp.sync(this.path, { fs: fs })
return
return Promise.resolve()
}

@@ -81,2 +102,6 @@

close () {
return Promise.resolve()
}
/**

@@ -87,3 +112,3 @@ * Calculate the directory and file name for a given key.

* @param {Key} key
* @returns {{string, string}}
* @returns {{dir:string, file:string}}
*/

@@ -203,3 +228,3 @@ _encode (key) {

* @param {Key} key
* @returns {Promise<bool>}
* @returns {Promise<boolean>}
*/

@@ -235,3 +260,8 @@ async has (key) {

async * _all (q) { // eslint-disable-line require-await
/**
*
* @param {Query} q
* @returns {AsyncIterable<Pair>}
*/
async * _all (q) {
let prefix = q.prefix || '**'

@@ -267,3 +297,3 @@

} else {
yield * map(files, f => ({ key: this._decode(f) }))
yield * map(files, f => /** @type {Pair} */({ key: this._decode(f) }))
}

@@ -270,0 +300,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc