lib/extends/_rmdirp.js
function _emptyDirectoryProm (directory) {

			return new Promise((resolve, reject) => {

				readdir(directory, (err, files) => {
					return err ? reject(err) : resolve(files);
				});

			}).then((files) => {

				const result = [];

					for (let i = 0; i < files.length; ++i) {
						result.push(join(directory, files[i]));
					}

				return Promise.resolve(result);

			}).then((files) => {
				return files.length ? _removeDirectoryContentProm(files) : Promise.resolve();
			});

		}
function _emptyDirectoryProm (directory) {

			return new Promise((resolve, reject) => {

				readdir(directory, (err, files) => {
					return err ? reject(err) : resolve(files);
				});

			}).then((files) => {

				const result = [];

					for (let i = 0; i < files.length; ++i) {
						result.push(join(directory, files[i]));
					}

				return Promise.resolve(result);

			}).then((files) => {
				return files.length ? _removeDirectoryContentProm(files) : Promise.resolve();
			});

		}
function _emptyDirectoryProm ( directory ) { return new Promise ( ( resolve , reject ) => { readdir ( directory , ( err , files ) => { return err ? reject ( err ) : resolve ( files ) ; } ) ; } ) . then ( ( files ) => { const result = [ ] ; for ( let i = 0 ; i < files . length ; ++ i ) { result . push ( join ( directory , files [ i ] ) ) ; } return Promise . resolve ( result ) ; } ) . then ( ( files ) => { return files . length ? _removeDirectoryContentProm ( files ) : Promise . resolve ( ) ; } ) ; }
Async empty directory
@param {string} directory : directory path
@returns {Promise}: Operation's result
Async empty directory