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

disklet

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

disklet - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

ios/Disklet.xcodeproj/xcuserdata/william.xcuserdatad/xcschemes/xcschememanagement.plist

5

CHANGELOG.md
# Disklet
## 0.4.3 (2019-10-23)
- Fix the TypeScript definitions not to conflict with React Native.
- Convert the internal type system from Flow to TypeScript.
## 0.4.2 (2019-09-17)

@@ -4,0 +9,0 @@

559

lib/disklet.cjs.js

@@ -11,2 +11,6 @@ 'use strict';

function makeReactNativeDisklet() {
throw new Error('makeReactNativeDisklet is not available on this platform');
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -66,168 +70,2 @@ try {

function _toArray(arr) {
return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function _addElementPlacement(element, placements, silent) {
var keys = placements[element.placement];
if (!silent && keys.indexOf(element.key) !== -1) {
throw new TypeError("Duplicated element (" + element.key + ")");
}
keys.push(element.key);
}
function _fromElementDescriptor(element) {
var obj = {
kind: element.kind,
key: element.key,
placement: element.placement,
descriptor: element.descriptor
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
if (element.kind === "field") obj.initializer = element.initializer;
return obj;
}
function _toElementDescriptors(elementObjects) {
if (elementObjects === undefined) return;
return _toArray(elementObjects).map(function (elementObject) {
var element = _toElementDescriptor(elementObject);
_disallowProperty(elementObject, "finisher", "An element descriptor");
_disallowProperty(elementObject, "extras", "An element descriptor");
return element;
});
}
function _toElementDescriptor(elementObject) {
var kind = String(elementObject.kind);
if (kind !== "method" && kind !== "field") {
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
}
var key = elementObject.key;
if (typeof key !== "string" && typeof key !== "symbol") key = String(key);
var placement = String(elementObject.placement);
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
}
var descriptor = elementObject.descriptor;
_disallowProperty(elementObject, "elements", "An element descriptor");
var element = {
kind: kind,
key: key,
placement: placement,
descriptor: Object.assign({}, descriptor)
};
if (kind !== "field") {
_disallowProperty(elementObject, "initializer", "A method descriptor");
} else {
_disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
element.initializer = elementObject.initializer;
}
return element;
}
function _toElementFinisherExtras(elementObject) {
var element = _toElementDescriptor(elementObject);
var finisher = _optionalCallableProperty(elementObject, "finisher");
var extras = _toElementDescriptors(elementObject.extras);
return {
element: element,
finisher: finisher,
extras: extras
};
}
function _fromClassDescriptor(elements) {
var obj = {
kind: "class",
elements: elements.map(_fromElementDescriptor)
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
return obj;
}
function _toClassDescriptor(obj) {
var kind = String(obj.kind);
if (kind !== "class") {
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
}
_disallowProperty(obj, "key", "A class descriptor");
_disallowProperty(obj, "placement", "A class descriptor");
_disallowProperty(obj, "descriptor", "A class descriptor");
_disallowProperty(obj, "initializer", "A class descriptor");
_disallowProperty(obj, "extras", "A class descriptor");
var finisher = _optionalCallableProperty(obj, "finisher");
var elements = _toElementDescriptors(obj.elements);
return {
elements: elements,
finisher: finisher
};
}
function _disallowProperty(obj, name, objectType) {
if (obj[name] !== undefined) {
throw new TypeError(objectType + " can't have a ." + name + " property.");
}
}
function _optionalCallableProperty(obj, name) {
var value = obj[name];
if (value !== undefined && typeof value !== "function") {
throw new TypeError("Expected '" + name + "' to be a function");
}
return value;
}
/**

@@ -265,3 +103,2 @@ * Interprets a path as a series of folder lookups,

*/
function storageKeys(storage) {

@@ -271,4 +108,5 @@ var out = [];

for (var i = 0; i < storage.length; ++i) {
var key = storage.key(i);
if (key) out.push(key);
var _key = storage.key(i);
if (_key != null) out.push(_key);
}

@@ -294,3 +132,3 @@

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -306,4 +144,4 @@

for (var _i2 = 0, _storageKeys2 = storageKeys(storage); _i2 < _storageKeys2.length; _i2++) {
var key = _storageKeys2[_i2];
if (key.indexOf(prefix + folder) === 0) storage.removeItem(key);
var _key2 = _storageKeys2[_i2];
if (_key2.indexOf(prefix + folder) === 0) storage.removeItem(_key2);
}

@@ -342,6 +180,8 @@

for (var _i4 = 0, _storageKeys4 = storageKeys(storage); _i4 < _storageKeys4.length; _i4++) {
var key = _storageKeys4[_i4];
if (key.indexOf(prefix + folder) !== 0) continue;
var slash = key.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[key.slice(prefix.length)] = 'file';else out[key.slice(prefix.length, slash)] = 'folder';
var _key3 = _storageKeys4[_i4];
if (_key3.indexOf(prefix + folder) !== 0) continue;
var slash = _key3.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[_key3.slice(prefix.length)] = 'file';else out[_key3.slice(prefix.length, slash)] = 'folder';
}

@@ -352,5 +192,7 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),

@@ -380,3 +222,3 @@ setData: function setData(path, data) {

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -448,8 +290,11 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),
setData: function setData(path, data) {
// We use `any` here becase Flow is too dumb to know that `ArrayLike`
// is a perfectly acceptable argument to `Uint8Array.from`:
var flowHack = data;

@@ -471,5 +316,7 @@ var array = Uint8Array.from(flowHack);

/* global Buffer */
function mkdir(path) {
return new Promise(function (resolve, reject) {
return fs.mkdir(path, void 0, function (err) {
return fs.mkdir(path, undefined, function (err) {
return err != null && err.code !== 'EEXIST' ? reject(err) : resolve();

@@ -482,4 +329,4 @@ });

return new Promise(function (resolve, reject) {
return fs.rmdir(path, function (err, out) {
return err != null ? reject(err) : resolve(out);
return fs.rmdir(path, function (err) {
return err != null ? reject(err) : resolve();
});

@@ -499,4 +346,4 @@ });

return new Promise(function (resolve, reject) {
return fs.unlink(path, function (err, out) {
return err != null ? reject(err) : resolve(out);
return fs.unlink(path, function (err) {
return err != null ? reject(err) : resolve();
});

@@ -508,4 +355,4 @@ });

return new Promise(function (resolve, reject) {
return fs.writeFile(path, data, opts, function (err, out) {
return err != null ? reject(err) : resolve(out);
return fs.writeFile(path, data, opts, function (err) {
return err != null ? reject(err) : resolve();
});

@@ -543,3 +390,3 @@ });

function deepMkdir(path) {
return mkdir(path).catch(function (err) {
return mkdir(path)["catch"](function (err) {
if (err.code !== 'ENOENT') throw err;

@@ -557,3 +404,3 @@ return deepMkdir(pathUtil.dirname(path)).then(function () {

function deepWriteFile(path, data, opts) {
return writeFile(path, data, opts).catch(function (err) {
return writeFile(path, data, opts)["catch"](function (err) {
if (err.code !== 'ENOENT') throw err;

@@ -587,3 +434,3 @@ return deepMkdir(pathUtil.dirname(path)).then(function () {

return {
delete: function _delete(path) {
"delete": function _delete(path) {
return deepDelete(locate(path));

@@ -628,3 +475,4 @@ },

for (var i = 0; i < names.length; ++i) {
if (types[i] !== '') out[folder + names[i]] = types[i];
var _type = types[i];
if (_type !== '') out[folder + names[i]] = _type;
}

@@ -650,136 +498,2 @@

function makeReactNativeDisklet() {
throw new Error('makeReactNativeDisklet is not available on this platform');
}
/**
* Recursively lists a folder.
*/
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
return console.log(operation + " \"" + path + "\"");
} : _opts$callback,
verbose = _opts.verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
delete: function _delete(path) {
log('delete', normalizePath(path));
return disklet.delete(path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
delete: function _delete(path) {
return Promise.all([master.delete(path), fallback.delete(path)]);
},
getData: function getData(path) {
return master.getData(path).catch(function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path).catch(function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
delete: function _delete(path) {
return disklet.delete(prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
var File =

@@ -795,4 +509,4 @@ /*#__PURE__*/

_proto.delete = function _delete() {
return this._disklet.delete(this._path);
_proto["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -829,4 +543,4 @@

_proto2.delete = function _delete() {
return this._disklet.delete(this._path);
_proto2["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -869,6 +583,2 @@

/**
* Interprets a path as a series of folder lookups,
* handling special components like `.` and `..`.
*/
function followPath(folder, parts) {

@@ -901,2 +611,3 @@ var i = 0; // Read index

var filename = parts.pop();
if (filename == null) throw new Error('Empty path');
return followPath(folder, parts).file(filename);

@@ -960,6 +671,9 @@ }

function log(path, operation, opts) {
var f = opts.callback != null ? opts.callback : logConsole;
var _opts$callback = opts.callback,
callback = _opts$callback === void 0 ? logConsole : _opts$callback,
_opts$verbose = opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
if (opts.verbose || /set|delete/.test(operation)) {
f(path, operation);
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}

@@ -979,5 +693,5 @@ }

_proto.delete = function _delete() {
_proto["delete"] = function _delete() {
log(this._path, 'delete file', this._opts);
return this._file.delete();
return this._file["delete"]();
};

@@ -1023,5 +737,5 @@

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
log(this._path, 'delete folder', this._opts);
return this._folder.delete();
return this._folder["delete"]();
};

@@ -1090,4 +804,4 @@

_proto.delete = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master.delete().catch(function (e) {
_proto["delete"] = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master["delete"]()["catch"](function (e) {
return null;

@@ -1100,3 +814,3 @@ })]);

return this._master.getData().catch(function (e) {
return this._master.getData()["catch"](function (e) {
return _this._whiteout.getData().then(function (data) {

@@ -1113,3 +827,3 @@ throw new Error('File has been deleted');

return this._master.getText().catch(function (e) {
return this._master.getText()["catch"](function (e) {
return _this2._whiteout.getData().then(function (data) {

@@ -1153,7 +867,7 @@ throw new Error('File has been deleted');

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
return Promise.all([mapFiles(this, function (file) {
return file.delete();
return file["delete"]();
}), mapFolders(this, function (folder) {
return folder.delete();
return folder["delete"]();
})]).then(function () {});

@@ -1188,3 +902,130 @@ };

// downgrade -----------------------------------------------------------------
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
console.log(operation + " \"" + path + "\"");
} : _opts$callback,
_opts$verbose = _opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
"delete": function _delete(path) {
log('delete', normalizePath(path));
return disklet["delete"](path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
"delete": function _delete(path) {
return Promise.all([master["delete"](path), fallback["delete"](path)]);
},
getData: function getData(path) {
return master.getData(path)["catch"](function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path)["catch"](function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
"delete": function _delete(path) {
return disklet["delete"](prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
function makeLocalStorageFolder(storage, opts) {

@@ -1204,13 +1045,15 @@ return downgradeDisklet(makeLocalStorageDisklet(storage, opts));

exports.deepList = deepList;
exports.downgradeDisklet = downgradeDisklet;
exports.locateFile = locateFile;
exports.locateFolder = locateFolder;
exports.logDisklet = logDisklet;
exports.makeLocalStorageDisklet = makeLocalStorageDisklet;
exports.makeLocalStorageFolder = makeLocalStorageFolder;
exports.makeLoggedFolder = makeLoggedFolder;
exports.makeMemoryDisklet = makeMemoryDisklet;
exports.makeMemoryFolder = makeMemoryFolder;
exports.makeNodeDisklet = makeNodeDisklet;
exports.makeNodeFolder = makeNodeFolder;
exports.makeReactNativeDisklet = makeReactNativeDisklet;
exports.mergeDisklets = mergeDisklets;
exports.navigateDisklet = navigateDisklet;
exports.downgradeDisklet = downgradeDisklet;
exports.locateFile = locateFile;
exports.locateFolder = locateFolder;
exports.makeLoggedFolder = makeLoggedFolder;
exports.makeReactNativeFolder = makeReactNativeFolder;
exports.makeUnionFolder = makeUnionFolder;

@@ -1220,6 +1063,4 @@ exports.mapAllFiles = mapAllFiles;

exports.mapFolders = mapFolders;
exports.makeLocalStorageFolder = makeLocalStorageFolder;
exports.makeMemoryFolder = makeMemoryFolder;
exports.makeNodeFolder = makeNodeFolder;
exports.makeReactNativeFolder = makeReactNativeFolder;
exports.mergeDisklets = mergeDisklets;
exports.navigateDisklet = navigateDisklet;
//# sourceMappingURL=disklet.cjs.js.map

@@ -5,2 +5,6 @@ import { base64 } from 'rfc4648';

function makeReactNativeDisklet() {
throw new Error('makeReactNativeDisklet is not available on this platform');
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -60,168 +64,2 @@ try {

function _toArray(arr) {
return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function _addElementPlacement(element, placements, silent) {
var keys = placements[element.placement];
if (!silent && keys.indexOf(element.key) !== -1) {
throw new TypeError("Duplicated element (" + element.key + ")");
}
keys.push(element.key);
}
function _fromElementDescriptor(element) {
var obj = {
kind: element.kind,
key: element.key,
placement: element.placement,
descriptor: element.descriptor
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
if (element.kind === "field") obj.initializer = element.initializer;
return obj;
}
function _toElementDescriptors(elementObjects) {
if (elementObjects === undefined) return;
return _toArray(elementObjects).map(function (elementObject) {
var element = _toElementDescriptor(elementObject);
_disallowProperty(elementObject, "finisher", "An element descriptor");
_disallowProperty(elementObject, "extras", "An element descriptor");
return element;
});
}
function _toElementDescriptor(elementObject) {
var kind = String(elementObject.kind);
if (kind !== "method" && kind !== "field") {
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
}
var key = elementObject.key;
if (typeof key !== "string" && typeof key !== "symbol") key = String(key);
var placement = String(elementObject.placement);
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
}
var descriptor = elementObject.descriptor;
_disallowProperty(elementObject, "elements", "An element descriptor");
var element = {
kind: kind,
key: key,
placement: placement,
descriptor: Object.assign({}, descriptor)
};
if (kind !== "field") {
_disallowProperty(elementObject, "initializer", "A method descriptor");
} else {
_disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
element.initializer = elementObject.initializer;
}
return element;
}
function _toElementFinisherExtras(elementObject) {
var element = _toElementDescriptor(elementObject);
var finisher = _optionalCallableProperty(elementObject, "finisher");
var extras = _toElementDescriptors(elementObject.extras);
return {
element: element,
finisher: finisher,
extras: extras
};
}
function _fromClassDescriptor(elements) {
var obj = {
kind: "class",
elements: elements.map(_fromElementDescriptor)
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
return obj;
}
function _toClassDescriptor(obj) {
var kind = String(obj.kind);
if (kind !== "class") {
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
}
_disallowProperty(obj, "key", "A class descriptor");
_disallowProperty(obj, "placement", "A class descriptor");
_disallowProperty(obj, "descriptor", "A class descriptor");
_disallowProperty(obj, "initializer", "A class descriptor");
_disallowProperty(obj, "extras", "A class descriptor");
var finisher = _optionalCallableProperty(obj, "finisher");
var elements = _toElementDescriptors(obj.elements);
return {
elements: elements,
finisher: finisher
};
}
function _disallowProperty(obj, name, objectType) {
if (obj[name] !== undefined) {
throw new TypeError(objectType + " can't have a ." + name + " property.");
}
}
function _optionalCallableProperty(obj, name) {
var value = obj[name];
if (value !== undefined && typeof value !== "function") {
throw new TypeError("Expected '" + name + "' to be a function");
}
return value;
}
/**

@@ -259,3 +97,2 @@ * Interprets a path as a series of folder lookups,

*/
function storageKeys(storage) {

@@ -265,4 +102,5 @@ var out = [];

for (var i = 0; i < storage.length; ++i) {
var key = storage.key(i);
if (key) out.push(key);
var _key = storage.key(i);
if (_key != null) out.push(_key);
}

@@ -288,3 +126,3 @@

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -300,4 +138,4 @@

for (var _i2 = 0, _storageKeys2 = storageKeys(storage); _i2 < _storageKeys2.length; _i2++) {
var key = _storageKeys2[_i2];
if (key.indexOf(prefix + folder) === 0) storage.removeItem(key);
var _key2 = _storageKeys2[_i2];
if (_key2.indexOf(prefix + folder) === 0) storage.removeItem(_key2);
}

@@ -336,6 +174,8 @@

for (var _i4 = 0, _storageKeys4 = storageKeys(storage); _i4 < _storageKeys4.length; _i4++) {
var key = _storageKeys4[_i4];
if (key.indexOf(prefix + folder) !== 0) continue;
var slash = key.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[key.slice(prefix.length)] = 'file';else out[key.slice(prefix.length, slash)] = 'folder';
var _key3 = _storageKeys4[_i4];
if (_key3.indexOf(prefix + folder) !== 0) continue;
var slash = _key3.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[_key3.slice(prefix.length)] = 'file';else out[_key3.slice(prefix.length, slash)] = 'folder';
}

@@ -346,5 +186,7 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),

@@ -374,3 +216,3 @@ setData: function setData(path, data) {

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -442,8 +284,11 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),
setData: function setData(path, data) {
// We use `any` here becase Flow is too dumb to know that `ArrayLike`
// is a perfectly acceptable argument to `Uint8Array.from`:
var flowHack = data;

@@ -465,5 +310,7 @@ var array = Uint8Array.from(flowHack);

/* global Buffer */
function mkdir(path) {
return new Promise(function (resolve, reject) {
return fs.mkdir(path, void 0, function (err) {
return fs.mkdir(path, undefined, function (err) {
return err != null && err.code !== 'EEXIST' ? reject(err) : resolve();

@@ -476,4 +323,4 @@ });

return new Promise(function (resolve, reject) {
return fs.rmdir(path, function (err, out) {
return err != null ? reject(err) : resolve(out);
return fs.rmdir(path, function (err) {
return err != null ? reject(err) : resolve();
});

@@ -493,4 +340,4 @@ });

return new Promise(function (resolve, reject) {
return fs.unlink(path, function (err, out) {
return err != null ? reject(err) : resolve(out);
return fs.unlink(path, function (err) {
return err != null ? reject(err) : resolve();
});

@@ -502,4 +349,4 @@ });

return new Promise(function (resolve, reject) {
return fs.writeFile(path, data, opts, function (err, out) {
return err != null ? reject(err) : resolve(out);
return fs.writeFile(path, data, opts, function (err) {
return err != null ? reject(err) : resolve();
});

@@ -537,3 +384,3 @@ });

function deepMkdir(path) {
return mkdir(path).catch(function (err) {
return mkdir(path)["catch"](function (err) {
if (err.code !== 'ENOENT') throw err;

@@ -551,3 +398,3 @@ return deepMkdir(pathUtil.dirname(path)).then(function () {

function deepWriteFile(path, data, opts) {
return writeFile(path, data, opts).catch(function (err) {
return writeFile(path, data, opts)["catch"](function (err) {
if (err.code !== 'ENOENT') throw err;

@@ -581,3 +428,3 @@ return deepMkdir(pathUtil.dirname(path)).then(function () {

return {
delete: function _delete(path) {
"delete": function _delete(path) {
return deepDelete(locate(path));

@@ -622,3 +469,4 @@ },

for (var i = 0; i < names.length; ++i) {
if (types[i] !== '') out[folder + names[i]] = types[i];
var _type = types[i];
if (_type !== '') out[folder + names[i]] = _type;
}

@@ -644,136 +492,2 @@

function makeReactNativeDisklet() {
throw new Error('makeReactNativeDisklet is not available on this platform');
}
/**
* Recursively lists a folder.
*/
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
return console.log(operation + " \"" + path + "\"");
} : _opts$callback,
verbose = _opts.verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
delete: function _delete(path) {
log('delete', normalizePath(path));
return disklet.delete(path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
delete: function _delete(path) {
return Promise.all([master.delete(path), fallback.delete(path)]);
},
getData: function getData(path) {
return master.getData(path).catch(function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path).catch(function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
delete: function _delete(path) {
return disklet.delete(prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
var File =

@@ -789,4 +503,4 @@ /*#__PURE__*/

_proto.delete = function _delete() {
return this._disklet.delete(this._path);
_proto["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -823,4 +537,4 @@

_proto2.delete = function _delete() {
return this._disklet.delete(this._path);
_proto2["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -863,6 +577,2 @@

/**
* Interprets a path as a series of folder lookups,
* handling special components like `.` and `..`.
*/
function followPath(folder, parts) {

@@ -895,2 +605,3 @@ var i = 0; // Read index

var filename = parts.pop();
if (filename == null) throw new Error('Empty path');
return followPath(folder, parts).file(filename);

@@ -954,6 +665,9 @@ }

function log(path, operation, opts) {
var f = opts.callback != null ? opts.callback : logConsole;
var _opts$callback = opts.callback,
callback = _opts$callback === void 0 ? logConsole : _opts$callback,
_opts$verbose = opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
if (opts.verbose || /set|delete/.test(operation)) {
f(path, operation);
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}

@@ -973,5 +687,5 @@ }

_proto.delete = function _delete() {
_proto["delete"] = function _delete() {
log(this._path, 'delete file', this._opts);
return this._file.delete();
return this._file["delete"]();
};

@@ -1017,5 +731,5 @@

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
log(this._path, 'delete folder', this._opts);
return this._folder.delete();
return this._folder["delete"]();
};

@@ -1084,4 +798,4 @@

_proto.delete = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master.delete().catch(function (e) {
_proto["delete"] = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master["delete"]()["catch"](function (e) {
return null;

@@ -1094,3 +808,3 @@ })]);

return this._master.getData().catch(function (e) {
return this._master.getData()["catch"](function (e) {
return _this._whiteout.getData().then(function (data) {

@@ -1107,3 +821,3 @@ throw new Error('File has been deleted');

return this._master.getText().catch(function (e) {
return this._master.getText()["catch"](function (e) {
return _this2._whiteout.getData().then(function (data) {

@@ -1147,7 +861,7 @@ throw new Error('File has been deleted');

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
return Promise.all([mapFiles(this, function (file) {
return file.delete();
return file["delete"]();
}), mapFolders(this, function (folder) {
return folder.delete();
return folder["delete"]();
})]).then(function () {});

@@ -1182,3 +896,130 @@ };

// downgrade -----------------------------------------------------------------
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
console.log(operation + " \"" + path + "\"");
} : _opts$callback,
_opts$verbose = _opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
"delete": function _delete(path) {
log('delete', normalizePath(path));
return disklet["delete"](path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
"delete": function _delete(path) {
return Promise.all([master["delete"](path), fallback["delete"](path)]);
},
getData: function getData(path) {
return master.getData(path)["catch"](function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path)["catch"](function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
"delete": function _delete(path) {
return disklet["delete"](prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
function makeLocalStorageFolder(storage, opts) {

@@ -1197,3 +1038,3 @@ return downgradeDisklet(makeLocalStorageDisklet(storage, opts));

export { deepList, logDisklet, makeLocalStorageDisklet, makeMemoryDisklet, makeNodeDisklet, makeReactNativeDisklet, mergeDisklets, navigateDisklet, downgradeDisklet, locateFile, locateFolder, makeLoggedFolder, makeUnionFolder, mapAllFiles, mapFiles, mapFolders, makeLocalStorageFolder, makeMemoryFolder, makeNodeFolder, makeReactNativeFolder };
export { deepList, downgradeDisklet, locateFile, locateFolder, logDisklet, makeLocalStorageDisklet, makeLocalStorageFolder, makeLoggedFolder, makeMemoryDisklet, makeMemoryFolder, makeNodeDisklet, makeNodeFolder, makeReactNativeDisklet, makeReactNativeFolder, makeUnionFolder, mapAllFiles, mapFiles, mapFolders, mergeDisklets, navigateDisklet };
//# sourceMappingURL=disklet.js.map

@@ -8,2 +8,6 @@ 'use strict';

function makeNodeDisklet(path) {
throw new Error('makeNodeDisklet is not available on this platform');
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -63,168 +67,2 @@ try {

function _toArray(arr) {
return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function _addElementPlacement(element, placements, silent) {
var keys = placements[element.placement];
if (!silent && keys.indexOf(element.key) !== -1) {
throw new TypeError("Duplicated element (" + element.key + ")");
}
keys.push(element.key);
}
function _fromElementDescriptor(element) {
var obj = {
kind: element.kind,
key: element.key,
placement: element.placement,
descriptor: element.descriptor
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
if (element.kind === "field") obj.initializer = element.initializer;
return obj;
}
function _toElementDescriptors(elementObjects) {
if (elementObjects === undefined) return;
return _toArray(elementObjects).map(function (elementObject) {
var element = _toElementDescriptor(elementObject);
_disallowProperty(elementObject, "finisher", "An element descriptor");
_disallowProperty(elementObject, "extras", "An element descriptor");
return element;
});
}
function _toElementDescriptor(elementObject) {
var kind = String(elementObject.kind);
if (kind !== "method" && kind !== "field") {
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
}
var key = elementObject.key;
if (typeof key !== "string" && typeof key !== "symbol") key = String(key);
var placement = String(elementObject.placement);
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
}
var descriptor = elementObject.descriptor;
_disallowProperty(elementObject, "elements", "An element descriptor");
var element = {
kind: kind,
key: key,
placement: placement,
descriptor: Object.assign({}, descriptor)
};
if (kind !== "field") {
_disallowProperty(elementObject, "initializer", "A method descriptor");
} else {
_disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
element.initializer = elementObject.initializer;
}
return element;
}
function _toElementFinisherExtras(elementObject) {
var element = _toElementDescriptor(elementObject);
var finisher = _optionalCallableProperty(elementObject, "finisher");
var extras = _toElementDescriptors(elementObject.extras);
return {
element: element,
finisher: finisher,
extras: extras
};
}
function _fromClassDescriptor(elements) {
var obj = {
kind: "class",
elements: elements.map(_fromElementDescriptor)
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
return obj;
}
function _toClassDescriptor(obj) {
var kind = String(obj.kind);
if (kind !== "class") {
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
}
_disallowProperty(obj, "key", "A class descriptor");
_disallowProperty(obj, "placement", "A class descriptor");
_disallowProperty(obj, "descriptor", "A class descriptor");
_disallowProperty(obj, "initializer", "A class descriptor");
_disallowProperty(obj, "extras", "A class descriptor");
var finisher = _optionalCallableProperty(obj, "finisher");
var elements = _toElementDescriptors(obj.elements);
return {
elements: elements,
finisher: finisher
};
}
function _disallowProperty(obj, name, objectType) {
if (obj[name] !== undefined) {
throw new TypeError(objectType + " can't have a ." + name + " property.");
}
}
function _optionalCallableProperty(obj, name) {
var value = obj[name];
if (value !== undefined && typeof value !== "function") {
throw new TypeError("Expected '" + name + "' to be a function");
}
return value;
}
/**

@@ -262,3 +100,2 @@ * Interprets a path as a series of folder lookups,

*/
function storageKeys(storage) {

@@ -268,4 +105,5 @@ var out = [];

for (var i = 0; i < storage.length; ++i) {
var key = storage.key(i);
if (key) out.push(key);
var _key = storage.key(i);
if (_key != null) out.push(_key);
}

@@ -291,3 +129,3 @@

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -303,4 +141,4 @@

for (var _i2 = 0, _storageKeys2 = storageKeys(storage); _i2 < _storageKeys2.length; _i2++) {
var key = _storageKeys2[_i2];
if (key.indexOf(prefix + folder) === 0) storage.removeItem(key);
var _key2 = _storageKeys2[_i2];
if (_key2.indexOf(prefix + folder) === 0) storage.removeItem(_key2);
}

@@ -339,6 +177,8 @@

for (var _i4 = 0, _storageKeys4 = storageKeys(storage); _i4 < _storageKeys4.length; _i4++) {
var key = _storageKeys4[_i4];
if (key.indexOf(prefix + folder) !== 0) continue;
var slash = key.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[key.slice(prefix.length)] = 'file';else out[key.slice(prefix.length, slash)] = 'folder';
var _key3 = _storageKeys4[_i4];
if (_key3.indexOf(prefix + folder) !== 0) continue;
var slash = _key3.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[_key3.slice(prefix.length)] = 'file';else out[_key3.slice(prefix.length, slash)] = 'folder';
}

@@ -349,5 +189,7 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),

@@ -377,3 +219,3 @@ setData: function setData(path, data) {

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -445,8 +287,11 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),
setData: function setData(path, data) {
// We use `any` here becase Flow is too dumb to know that `ArrayLike`
// is a perfectly acceptable argument to `Uint8Array.from`:
var flowHack = data;

@@ -468,8 +313,3 @@ var array = Uint8Array.from(flowHack);

function makeNodeDisklet(path) {
throw new Error('makeNodeDisklet is not available on this platform');
}
// $FlowFixMe - React Native won't be installed in non-RN environments:
var native = reactNative.NativeModules.Disklet;
var _native = reactNative.NativeModules.Disklet;
/**

@@ -479,9 +319,9 @@ * Returns a Disklet interface located in the application's data directory.

function makeReactNativeDisklet$1() {
function makeReactNativeDisklet() {
return {
delete: function _delete(path) {
return native.delete(normalizePath(path));
"delete": function _delete(path) {
return _native["delete"](normalizePath(path));
},
getData: function getData(path) {
return native.getData(normalizePath(path)).then(function (data) {
return _native.getData(normalizePath(path)).then(function (data) {
return rfc4648.base64.parse(data);

@@ -491,3 +331,3 @@ });

getText: function getText(path) {
return native.getText(normalizePath(path));
return _native.getText(normalizePath(path));
},

@@ -499,9 +339,9 @@ list: function list(path) {

return native.list(normalizePath(path));
return _native.list(normalizePath(path));
},
setData: function setData(path, data) {
return native.setData(normalizePath(path), rfc4648.base64.stringify(data));
return _native.setData(normalizePath(path), rfc4648.base64.stringify(data));
},
setText: function setText(path, text) {
return native.setText(normalizePath(path), text);
return _native.setText(normalizePath(path), text);
}

@@ -511,132 +351,2 @@ };

/**
* Recursively lists a folder.
*/
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
return console.log(operation + " \"" + path + "\"");
} : _opts$callback,
verbose = _opts.verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
delete: function _delete(path) {
log('delete', normalizePath(path));
return disklet.delete(path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
delete: function _delete(path) {
return Promise.all([master.delete(path), fallback.delete(path)]);
},
getData: function getData(path) {
return master.getData(path).catch(function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path).catch(function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
delete: function _delete(path) {
return disklet.delete(prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
var File =

@@ -652,4 +362,4 @@ /*#__PURE__*/

_proto.delete = function _delete() {
return this._disklet.delete(this._path);
_proto["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -686,4 +396,4 @@

_proto2.delete = function _delete() {
return this._disklet.delete(this._path);
_proto2["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -726,6 +436,2 @@

/**
* Interprets a path as a series of folder lookups,
* handling special components like `.` and `..`.
*/
function followPath(folder, parts) {

@@ -758,2 +464,3 @@ var i = 0; // Read index

var filename = parts.pop();
if (filename == null) throw new Error('Empty path');
return followPath(folder, parts).file(filename);

@@ -817,6 +524,9 @@ }

function log(path, operation, opts) {
var f = opts.callback != null ? opts.callback : logConsole;
var _opts$callback = opts.callback,
callback = _opts$callback === void 0 ? logConsole : _opts$callback,
_opts$verbose = opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
if (opts.verbose || /set|delete/.test(operation)) {
f(path, operation);
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}

@@ -836,5 +546,5 @@ }

_proto.delete = function _delete() {
_proto["delete"] = function _delete() {
log(this._path, 'delete file', this._opts);
return this._file.delete();
return this._file["delete"]();
};

@@ -880,5 +590,5 @@

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
log(this._path, 'delete folder', this._opts);
return this._folder.delete();
return this._folder["delete"]();
};

@@ -947,4 +657,4 @@

_proto.delete = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master.delete().catch(function (e) {
_proto["delete"] = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master["delete"]()["catch"](function (e) {
return null;

@@ -957,3 +667,3 @@ })]);

return this._master.getData().catch(function (e) {
return this._master.getData()["catch"](function (e) {
return _this._whiteout.getData().then(function (data) {

@@ -970,3 +680,3 @@ throw new Error('File has been deleted');

return this._master.getText().catch(function (e) {
return this._master.getText()["catch"](function (e) {
return _this2._whiteout.getData().then(function (data) {

@@ -1010,7 +720,7 @@ throw new Error('File has been deleted');

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
return Promise.all([mapFiles(this, function (file) {
return file.delete();
return file["delete"]();
}), mapFolders(this, function (folder) {
return folder.delete();
return folder["delete"]();
})]).then(function () {});

@@ -1045,3 +755,130 @@ };

// downgrade -----------------------------------------------------------------
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
console.log(operation + " \"" + path + "\"");
} : _opts$callback,
_opts$verbose = _opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
"delete": function _delete(path) {
log('delete', normalizePath(path));
return disklet["delete"](path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
"delete": function _delete(path) {
return Promise.all([master["delete"](path), fallback["delete"](path)]);
},
getData: function getData(path) {
return master.getData(path)["catch"](function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path)["catch"](function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
"delete": function _delete(path) {
return disklet["delete"](prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
function makeLocalStorageFolder(storage, opts) {

@@ -1054,20 +891,22 @@ return downgradeDisklet(makeLocalStorageDisklet(storage, opts));

function makeNodeFolder(path) {
return downgradeDisklet(makeNodeDisklet(path));
return downgradeDisklet(makeNodeDisklet());
}
function makeReactNativeFolder() {
return downgradeDisklet(makeReactNativeDisklet$1());
return downgradeDisklet(makeReactNativeDisklet());
}
exports.deepList = deepList;
exports.downgradeDisklet = downgradeDisklet;
exports.locateFile = locateFile;
exports.locateFolder = locateFolder;
exports.logDisklet = logDisklet;
exports.makeLocalStorageDisklet = makeLocalStorageDisklet;
exports.makeLocalStorageFolder = makeLocalStorageFolder;
exports.makeLoggedFolder = makeLoggedFolder;
exports.makeMemoryDisklet = makeMemoryDisklet;
exports.makeMemoryFolder = makeMemoryFolder;
exports.makeNodeDisklet = makeNodeDisklet;
exports.makeReactNativeDisklet = makeReactNativeDisklet$1;
exports.mergeDisklets = mergeDisklets;
exports.navigateDisklet = navigateDisklet;
exports.downgradeDisklet = downgradeDisklet;
exports.locateFile = locateFile;
exports.locateFolder = locateFolder;
exports.makeLoggedFolder = makeLoggedFolder;
exports.makeNodeFolder = makeNodeFolder;
exports.makeReactNativeDisklet = makeReactNativeDisklet;
exports.makeReactNativeFolder = makeReactNativeFolder;
exports.makeUnionFolder = makeUnionFolder;

@@ -1077,6 +916,4 @@ exports.mapAllFiles = mapAllFiles;

exports.mapFolders = mapFolders;
exports.makeLocalStorageFolder = makeLocalStorageFolder;
exports.makeMemoryFolder = makeMemoryFolder;
exports.makeNodeFolder = makeNodeFolder;
exports.makeReactNativeFolder = makeReactNativeFolder;
exports.mergeDisklets = mergeDisklets;
exports.navigateDisklet = navigateDisklet;
//# sourceMappingURL=disklet.rn.js.map

@@ -7,2 +7,9 @@ 'use strict';

function makeNodeDisklet(path) {
throw new Error('makeNodeDisklet is not available on this platform');
}
function makeReactNativeDisklet() {
throw new Error('makeReactNativeDisklet is not available on this platform');
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -62,168 +69,2 @@ try {

function _toArray(arr) {
return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function _addElementPlacement(element, placements, silent) {
var keys = placements[element.placement];
if (!silent && keys.indexOf(element.key) !== -1) {
throw new TypeError("Duplicated element (" + element.key + ")");
}
keys.push(element.key);
}
function _fromElementDescriptor(element) {
var obj = {
kind: element.kind,
key: element.key,
placement: element.placement,
descriptor: element.descriptor
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
if (element.kind === "field") obj.initializer = element.initializer;
return obj;
}
function _toElementDescriptors(elementObjects) {
if (elementObjects === undefined) return;
return _toArray(elementObjects).map(function (elementObject) {
var element = _toElementDescriptor(elementObject);
_disallowProperty(elementObject, "finisher", "An element descriptor");
_disallowProperty(elementObject, "extras", "An element descriptor");
return element;
});
}
function _toElementDescriptor(elementObject) {
var kind = String(elementObject.kind);
if (kind !== "method" && kind !== "field") {
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
}
var key = elementObject.key;
if (typeof key !== "string" && typeof key !== "symbol") key = String(key);
var placement = String(elementObject.placement);
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
}
var descriptor = elementObject.descriptor;
_disallowProperty(elementObject, "elements", "An element descriptor");
var element = {
kind: kind,
key: key,
placement: placement,
descriptor: Object.assign({}, descriptor)
};
if (kind !== "field") {
_disallowProperty(elementObject, "initializer", "A method descriptor");
} else {
_disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
element.initializer = elementObject.initializer;
}
return element;
}
function _toElementFinisherExtras(elementObject) {
var element = _toElementDescriptor(elementObject);
var finisher = _optionalCallableProperty(elementObject, "finisher");
var extras = _toElementDescriptors(elementObject.extras);
return {
element: element,
finisher: finisher,
extras: extras
};
}
function _fromClassDescriptor(elements) {
var obj = {
kind: "class",
elements: elements.map(_fromElementDescriptor)
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
return obj;
}
function _toClassDescriptor(obj) {
var kind = String(obj.kind);
if (kind !== "class") {
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
}
_disallowProperty(obj, "key", "A class descriptor");
_disallowProperty(obj, "placement", "A class descriptor");
_disallowProperty(obj, "descriptor", "A class descriptor");
_disallowProperty(obj, "initializer", "A class descriptor");
_disallowProperty(obj, "extras", "A class descriptor");
var finisher = _optionalCallableProperty(obj, "finisher");
var elements = _toElementDescriptors(obj.elements);
return {
elements: elements,
finisher: finisher
};
}
function _disallowProperty(obj, name, objectType) {
if (obj[name] !== undefined) {
throw new TypeError(objectType + " can't have a ." + name + " property.");
}
}
function _optionalCallableProperty(obj, name) {
var value = obj[name];
if (value !== undefined && typeof value !== "function") {
throw new TypeError("Expected '" + name + "' to be a function");
}
return value;
}
/**

@@ -261,3 +102,2 @@ * Interprets a path as a series of folder lookups,

*/
function storageKeys(storage) {

@@ -267,4 +107,5 @@ var out = [];

for (var i = 0; i < storage.length; ++i) {
var key = storage.key(i);
if (key) out.push(key);
var _key = storage.key(i);
if (_key != null) out.push(_key);
}

@@ -290,3 +131,3 @@

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -302,4 +143,4 @@

for (var _i2 = 0, _storageKeys2 = storageKeys(storage); _i2 < _storageKeys2.length; _i2++) {
var key = _storageKeys2[_i2];
if (key.indexOf(prefix + folder) === 0) storage.removeItem(key);
var _key2 = _storageKeys2[_i2];
if (_key2.indexOf(prefix + folder) === 0) storage.removeItem(_key2);
}

@@ -338,6 +179,8 @@

for (var _i4 = 0, _storageKeys4 = storageKeys(storage); _i4 < _storageKeys4.length; _i4++) {
var key = _storageKeys4[_i4];
if (key.indexOf(prefix + folder) !== 0) continue;
var slash = key.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[key.slice(prefix.length)] = 'file';else out[key.slice(prefix.length, slash)] = 'folder';
var _key3 = _storageKeys4[_i4];
if (_key3.indexOf(prefix + folder) !== 0) continue;
var slash = _key3.indexOf('/', prefix.length + folder.length);
if (slash < 0) out[_key3.slice(prefix.length)] = 'file';else out[_key3.slice(prefix.length, slash)] = 'folder';
}

@@ -348,5 +191,7 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),

@@ -376,3 +221,3 @@ setData: function setData(path, data) {

return {
delete: function _delete(path) {
"delete": function _delete(path) {
var file = normalizePath(path); // Try deleteing as a file:

@@ -444,8 +289,11 @@

return function list(_x) {
function list(_x) {
return _list.apply(this, arguments);
};
}
return list;
}(),
setData: function setData(path, data) {
// We use `any` here becase Flow is too dumb to know that `ArrayLike`
// is a perfectly acceptable argument to `Uint8Array.from`:
var flowHack = data;

@@ -467,139 +315,2 @@ var array = Uint8Array.from(flowHack);

function makeNodeDisklet(path) {
throw new Error('makeNodeDisklet is not available on this platform');
}
function makeReactNativeDisklet() {
throw new Error('makeReactNativeDisklet is not available on this platform');
}
/**
* Recursively lists a folder.
*/
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
return console.log(operation + " \"" + path + "\"");
} : _opts$callback,
verbose = _opts.verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
delete: function _delete(path) {
log('delete', normalizePath(path));
return disklet.delete(path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
delete: function _delete(path) {
return Promise.all([master.delete(path), fallback.delete(path)]);
},
getData: function getData(path) {
return master.getData(path).catch(function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path).catch(function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
delete: function _delete(path) {
return disklet.delete(prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
var File =

@@ -615,4 +326,4 @@ /*#__PURE__*/

_proto.delete = function _delete() {
return this._disklet.delete(this._path);
_proto["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -649,4 +360,4 @@

_proto2.delete = function _delete() {
return this._disklet.delete(this._path);
_proto2["delete"] = function _delete() {
return this._disklet["delete"](this._path);
};

@@ -689,6 +400,2 @@

/**
* Interprets a path as a series of folder lookups,
* handling special components like `.` and `..`.
*/
function followPath(folder, parts) {

@@ -721,2 +428,3 @@ var i = 0; // Read index

var filename = parts.pop();
if (filename == null) throw new Error('Empty path');
return followPath(folder, parts).file(filename);

@@ -780,6 +488,9 @@ }

function log(path, operation, opts) {
var f = opts.callback != null ? opts.callback : logConsole;
var _opts$callback = opts.callback,
callback = _opts$callback === void 0 ? logConsole : _opts$callback,
_opts$verbose = opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
if (opts.verbose || /set|delete/.test(operation)) {
f(path, operation);
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}

@@ -799,5 +510,5 @@ }

_proto.delete = function _delete() {
_proto["delete"] = function _delete() {
log(this._path, 'delete file', this._opts);
return this._file.delete();
return this._file["delete"]();
};

@@ -843,5 +554,5 @@

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
log(this._path, 'delete folder', this._opts);
return this._folder.delete();
return this._folder["delete"]();
};

@@ -910,4 +621,4 @@

_proto.delete = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master.delete().catch(function (e) {
_proto["delete"] = function _delete() {
return Promise.all([this._whiteout.setData([]), this._master["delete"]()["catch"](function (e) {
return null;

@@ -920,3 +631,3 @@ })]);

return this._master.getData().catch(function (e) {
return this._master.getData()["catch"](function (e) {
return _this._whiteout.getData().then(function (data) {

@@ -933,3 +644,3 @@ throw new Error('File has been deleted');

return this._master.getText().catch(function (e) {
return this._master.getText()["catch"](function (e) {
return _this2._whiteout.getData().then(function (data) {

@@ -973,7 +684,7 @@ throw new Error('File has been deleted');

_proto2.delete = function _delete() {
_proto2["delete"] = function _delete() {
return Promise.all([mapFiles(this, function (file) {
return file.delete();
return file["delete"]();
}), mapFolders(this, function (folder) {
return folder.delete();
return folder["delete"]();
})]).then(function () {});

@@ -1008,3 +719,130 @@ };

// downgrade -----------------------------------------------------------------
function deepList(disklet, path) {
return disklet.list(path).then(function (list) {
return (// Recurse into subfolders:
Promise.all(Object.keys(list).filter(function (path) {
return list[path] === 'folder';
}).map(function (path) {
return deepList(disklet, path);
})).then(function (children) {
return _extends.apply(void 0, [list].concat(children));
})
);
});
}
function logDisklet(disklet, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$callback = _opts.callback,
callback = _opts$callback === void 0 ? function (path, operation) {
console.log(operation + " \"" + path + "\"");
} : _opts$callback,
_opts$verbose = _opts.verbose,
verbose = _opts$verbose === void 0 ? false : _opts$verbose;
var log = function log(operation, path) {
if (verbose || /set|delete/.test(operation)) {
callback(path, operation);
}
};
return {
"delete": function _delete(path) {
log('delete', normalizePath(path));
return disklet["delete"](path);
},
getData: function getData(path) {
log('get data', normalizePath(path));
return disklet.getData(path);
},
getText: function getText(path) {
log('get text', normalizePath(path));
return disklet.getText(path);
},
list: function list(path) {
log('list', path != null ? normalizePath(path) : '');
return disklet.list(path);
},
setData: function setData(path, data) {
log('set data', normalizePath(path));
return disklet.setData(path, data);
},
setText: function setText(path, text) {
log('set text', normalizePath(path));
return disklet.setText(path, text);
}
};
}
function mergeDisklets(master, fallback) {
return {
"delete": function _delete(path) {
return Promise.all([master["delete"](path), fallback["delete"](path)]);
},
getData: function getData(path) {
return master.getData(path)["catch"](function (e) {
return fallback.getData(path);
});
},
getText: function getText(path) {
return master.getText(path)["catch"](function (e) {
return fallback.getText(path);
});
},
list: function list(path) {
return Promise.all([master.list(path), fallback.list(path)]).then(function (_ref) {
var masterList = _ref[0],
fallbackList = _ref[1];
return _extends(fallbackList, masterList);
});
},
setData: function setData(path, data) {
return master.setData(path, data);
},
setText: function setText(path, text) {
return master.setText(path, text);
}
};
}
function navigateDisklet(disklet, path) {
var prefix = folderizePath(normalizePath(path));
return {
"delete": function _delete(path) {
return disklet["delete"](prefix + path);
},
getData: function getData(path) {
return disklet.getData(prefix + path);
},
getText: function getText(path) {
return disklet.getText(prefix + path);
},
list: function list(path) {
if (path === void 0) {
path = '.';
}
return disklet.list(prefix + path).then(function (listing) {
var out = {};
for (var _path in listing) {
out[_path.replace(prefix, '')] = listing[_path];
}
return out;
});
},
setData: function setData(path, data) {
return disklet.setData(prefix + path, data);
},
setText: function setText(path, text) {
return disklet.setText(prefix + path, text);
}
};
}
function makeLocalStorageFolder(storage, opts) {

@@ -1017,3 +855,3 @@ return downgradeDisklet(makeLocalStorageDisklet(storage, opts));

function makeNodeFolder(path) {
return downgradeDisklet(makeNodeDisklet(path));
return downgradeDisklet(makeNodeDisklet());
}

@@ -1025,13 +863,15 @@ function makeReactNativeFolder() {

exports.deepList = deepList;
exports.downgradeDisklet = downgradeDisklet;
exports.locateFile = locateFile;
exports.locateFolder = locateFolder;
exports.logDisklet = logDisklet;
exports.makeLocalStorageDisklet = makeLocalStorageDisklet;
exports.makeLocalStorageFolder = makeLocalStorageFolder;
exports.makeLoggedFolder = makeLoggedFolder;
exports.makeMemoryDisklet = makeMemoryDisklet;
exports.makeMemoryFolder = makeMemoryFolder;
exports.makeNodeDisklet = makeNodeDisklet;
exports.makeNodeFolder = makeNodeFolder;
exports.makeReactNativeDisklet = makeReactNativeDisklet;
exports.mergeDisklets = mergeDisklets;
exports.navigateDisklet = navigateDisklet;
exports.downgradeDisklet = downgradeDisklet;
exports.locateFile = locateFile;
exports.locateFolder = locateFolder;
exports.makeLoggedFolder = makeLoggedFolder;
exports.makeReactNativeFolder = makeReactNativeFolder;
exports.makeUnionFolder = makeUnionFolder;

@@ -1041,6 +881,4 @@ exports.mapAllFiles = mapAllFiles;

exports.mapFolders = mapFolders;
exports.makeLocalStorageFolder = makeLocalStorageFolder;
exports.makeMemoryFolder = makeMemoryFolder;
exports.makeNodeFolder = makeNodeFolder;
exports.makeReactNativeFolder = makeReactNativeFolder;
exports.mergeDisklets = mergeDisklets;
exports.navigateDisklet = navigateDisklet;
//# sourceMappingURL=disklet.web.js.map
{
"name": "disklet",
"version": "0.4.2",
"version": "0.4.3",
"description": "A tiny, composable filesystem API",

@@ -33,22 +33,16 @@ "homepage": "https://github.com/EdgeApp/disklet",

"browser": "lib/disklet.web.js",
"types": "src/index.d.ts",
"types": "lib/src/index.d.ts",
"scripts": {
"build": "rimraf lib && rollup -c",
"flow": "flow",
"format": "import-sort -l --write '*.js' 'src/**/*.js' 'test/**/*.js'; prettier-eslint --write '*.js' 'src/**/*.js' 'test/**/*.js'",
"lint": "eslint '*.js' 'src/**/*.js' 'test/**/*.js'",
"precommit": "lint-staged && flow && npm test",
"build": "rimraf lib && rollup -c && tsc",
"format": "npm run lint -- --fix",
"lint": "eslint --ignore-path .gitignore --ext .js,.ts .",
"precommit": "lint-staged && npm test && npm run build",
"prepare": "npm run build",
"pretest": "rollup -c test/rollup.config.js",
"test": "mocha -r source-map-support/register build/tests.js"
"test": "mocha -r sucrase/register test/**/*.test.ts"
},
"lint-staged": {
"*.js": [
"eslint",
"import-sort --list-different",
"prettier-eslint --list-different"
]
"*.{js,ts}": "eslint"
},
"dependencies": {
"rfc4648": "^1.0.0"
"rfc4648": "^1.3.0"
},

@@ -59,36 +53,37 @@ "devDependencies": {

"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-eslint": "^10.0.1",
"@babel/preset-typescript": "^7.0.0",
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"@types/node": "^12.7.8",
"@types/react-native": "^0.60.16",
"@types/rimraf": "^2.0.2",
"@types/tmp": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^2.3.1",
"@typescript-eslint/parser": "^2.3.1",
"babel-eslint": "^10.0.3",
"chai": "^4.2.0",
"eslint": "^5.8.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-flowtype": "^3.1.4",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"flow-bin": "^0.78.0",
"eslint": "^6.4.0",
"eslint-config-standard-kit": "^0.14.4",
"eslint-plugin-flowtype": "^4.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-simple-import-sort": "^4.0.0",
"eslint-plugin-standard": "^4.0.1",
"husky": "^0.13.3",
"import-sort-cli": "^5.2.0",
"import-sort-parser-babylon": "^5.2.0",
"import-sort-style-module": "^5.0.0",
"lint-staged": "^8.0.4",
"mocha": "^6.2.0",
"prettier-eslint-cli": "^4.7.1",
"prettier": "^1.18.2",
"rimraf": "^2.6.2",
"rollup": "0.48.0",
"rollup-plugin-alias": "^1.4.0",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-filesize": "^4.0.1",
"rollup-plugin-flow-entry": "^0.2.0",
"source-map-support": "^0.4.14",
"tmp": "^0.0.31"
"rollup": "^1.21.4",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-filesize": "^6.2.0",
"rollup-plugin-flow-entry": "^0.3.3",
"rollup-plugin-node-resolve": "^5.2.0",
"sucrase": "^3.10.1",
"tmp": "^0.0.31",
"typescript": "^3.6.3"
},
"importSort": {
".js, .es": {
"parser": "babylon",
"style": "module"
}
},
"react-native": "lib/disklet.rn.js"
}

@@ -175,3 +175,3 @@ # Disklet

#### `delete(path: string): Promise<mixed>`
#### `delete(path: string): Promise<unknown>`

@@ -192,8 +192,8 @@ Recursively deletes a file or folder (including all contents). Does nothing if the path doesn't exist.

#### `setData(path: string, data: ArrayLike<number>): Promise<mixed>`
#### `setData(path: string, data: ArrayLike<number>): Promise<unknown>`
Writes an array of bytes to disk as a file. This will recursively create any folders needed to hold the file.
#### `setText(path: string, text: string): Promise<mixed>`
#### `setText(path: string, text: string): Promise<unknown>`
Writes a string to disk as a file. This will recursively create any folders needed to hold the file.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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