INNER CODE UNIT · JavaScript

copyFilesTo

mylofi/webauthn-local-client · scripts/build-gh-pages.js:59

async function copyFilesTo(files,fromBasePath,toDir,skipPatterns) {
	for (let fromPath of files) {
		// should we skip copying this file?
		if (matchesSkipPattern(fromPath,skipPatterns)) {
			continue;
		}

		let relativePath = fromPath.slice(fromBasePath.length);
		let outputPath = path.join(toDir,relativePath);
		let outputDir = path.dirname(outputPath);

		if (!(fs.existsSync(outputDir))) {
			if (!(await safeMkdir(outputDir))) {
				throw new Error(`While copying files, directory (${outputDir}) could not be created.`);
			}
		}

		await fsp.copyFile(fromPath,outputPath);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…