How to use the pify.all function in pify

To help you get started, we’ve selected a few pify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kevva / xdg-trash / index.js View on Github external
'use strict';
var path = require('path');
var fsExtra = require('fs-extra');
var pify = require('pify');
var Promise = require('pinkie-promise');
var uuid = require('uuid');
var xdgTrashdir = require('xdg-trashdir');
var fs = pify.all(fsExtra, Promise);

function trash(src) {
	return xdgTrashdir(src).then(function (dir) {
		var name = uuid.v4();
		var dest = path.join(dir, 'files', name);
		var info = path.join(dir, 'info', name + '.trashinfo');
		var msg = [
			'[Trash Info]',
			'Path=' + src.replace(/\s/g, '%20'),
			'DeletionDate=' + new Date().toISOString()
		].join('\n');

		return Promise.all([
			fs.move(src, dest, {mkdirp: true}).then(function () {
				return dest;
			}),

pify

Promisify a callback-style function

MIT
Latest version published 2 years ago

Package Health Score

73 / 100
Full package analysis

Popular pify functions