How to use the fs-jetpack.copyAsync function in fs-jetpack

To help you get started, we’ve selected a few fs-jetpack 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 evilz / vscode-reveal / src / ExportHTML.ts View on Github external
// console.log(`Saving file ${filePath}`)
  // await fs.mkdir(path.dirname(filePath), {recursive:true})
  
  if (data) {
    try {
      await jetpack.writeAsync(filePath, data)
      return
     
    } catch (error) {
      console.error(error)
    }
  }
  if (srcFilePath) {

    try {
      await jetpack.copyAsync(srcFilePath, filePath, {overwrite : true})
      return
    } catch (error) {
      console.error(error)
    }
  }

}
github ashmind / SharpLab / source / WebApp / build.ts View on Github external
const icons = task('icons', async () => {
    await jetpack.dirAsync(outputRoot);
    const pngGeneration = iconSizes.map(size => {
        // https://github.com/lovell/sharp/issues/729
        const density = size > 128 ? Math.round(72 * size / 128) : 72;
        return sharp(paths.from.icon, { density })
            .resize(size, size)
            .png()
            .toFile(paths.to.icon.png.replace('{size}', size.toString()));
    });

    return parallel(
        jetpack.copyAsync(paths.from.icon, paths.to.icon.svg, { overwrite: true }),
        ...pngGeneration
    ) as unknown as Promise;
}, {
    timeout: 5000,
github RocketChat / Rocket.Chat.Electron / src / main / appData.js View on Github external
async function migrate() {
	const olderAppName = 'Rocket.Chat+';
	const dirName = process.env.NODE_ENV === 'production' ? olderAppName : `${ olderAppName } (${ process.env.NODE_ENV })`;
	const olderUserDataPath = path.join(app.getPath('appData'), dirName);

	try {
		await jetpack.copyAsync(olderUserDataPath, app.getPath('userData'), { overwrite: true });
		await jetpack.removeAsync(olderUserDataPath);
	} catch (error) {
		if (jetpack.exists(olderUserDataPath)) {
			throw error;
		}

		console.log('No data to migrate.');
	}
}
github ocReaper / redmine-desktop / gulp / build.js View on Github external
gulp.task('electronStarterCopy', ['inject'], function () {
    projectDir.copyAsync('package.json', projectDir.path('build/app') + '/package.json', { overwrite: true });

    return gulp.src([
        config.appElectronFile
      ])
      .pipe(gulp.dest(config.buildDir));
  });
github ashmind / mirrorsharp / WebAssets / build.js View on Github external
task('css', () => jetpack.copyAsync('css', 'dist', { overwrite: true }), { inputs: ['css/*.*'] });
github ashmind / mirrorsharp / WebAssets / build.ts View on Github external
const css = task('css', () => jetpack.copyAsync('css', 'dist', { overwrite: true }), { watch: ['css/*.*'] });
github ebu / pi-list / apps / listwebserver / controllers / capture.js View on Github external
.then(() => {
            jetpack.copyAsync(captureOptions.file, destinationFile)
                .then(() => {
                    jetpack.remove(captureOptions.file);
                    res.status(HTTP_STATUS_CODE.SUCCESS.CREATED).send();
                    next();
                })
                .catch((e) => {
                    logger('live').error(`Could not copy pcap file: ${e}`);
                    res.status(HTTP_STATUS_CODE.CLIENT_ERROR.BAD_REQUEST).send(API_ERRORS.UNEXPECTED_ERROR);
                });
        })
        .catch(e => {
github RocketChat / Rocket.Chat.Electron / src / main / spellchecking.js View on Github external
const doInstallSpellCheckingDictionaries = function* ({ payload: filePaths }) {
	const { spellchecking: { dictionaryInstallationDirectory } } = yield select();

	for (const filePath of filePaths) {
		const dictionary = path.basename(filePath, path.extname(filePath));
		const basename = path.basename(filePath);
		const newPath = path.join(dictionaryInstallationDirectory, basename);
		try {
			yield jetpack.copyAsync(filePath, newPath);
			yield put(spellCheckingDictionaryInstalled(dictionary));
		} catch (error) {
			yield put(spellCheckingDictionaryInstallFailed(dictionary, error));
		}
	}
};
github bartsmykla / Chrome-Firefox-Opera-Edge-Safari-Extensions-Boilerplate-with-Hot-Module-Replacement / scripts / [to-remove]copy.js View on Github external
const copyTask = (browser) => jetpack.copyAsync('src/extension', `build/${browser}`, {
  overwrite: true,
  matching: [
    './background/background.html',
    './bookmark/popup.html',
    './images/**/*.{png,jpg,gif}',
  ]
});
github RocketChat / Rocket.Chat.Electron / src / preload / spellchecking.js View on Github external
await Promise.all(filePaths.map(async (filePath) => {
			const name = filePath.basename(filePath, filePath.extname(filePath));
			const basename = filePath.basename(filePath);
			const newPath = filePath.join(this.dictionariesPath, basename);

			await jetpack.copyAsync(filePath, newPath);

			if (!this.dictionaries.includes(name)) {
				this.dictionaries.push(name);
			}
		}));
	}