• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript fs-extra.renameSync函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中fs-extra.renameSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript renameSync函数的具体用法?TypeScript renameSync怎么用?TypeScript renameSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了renameSync函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: parseData

							child.on('close', (code: number) => {
								if (errorLine.trim().length > 0) {
									if (errorData) {
										parseData(errorLine.trim());
									}
									else {
										log.error(errorLine.trim());
									}
								}

								if (code === 0) {
									if (this.type !== 'metal' || this.platform === Platform.Krom) {
										if (compiledShader.files === null || compiledShader.files.length === 0) {
											fs.renameSync(temp, to);
										}
										for (let file of compiledShader.files) {
											fs.renameSync(path.join(this.to, file + '.temp'), path.join(this.to, file));
										}
									}
									resolve(compiledShader);
								}
								else {
									process.exitCode = 1;
									reject('Shader compiler error.');
								}
							});
开发者ID:KTXSoftware,项目名称:khamake,代码行数:26,代码来源:ShaderCompiler.ts


示例2: setupFixtureRepository

export function setupFixtureRepository(repositoryName: string): string {
  const testRepoFixturePath = Path.join(__dirname, 'fixtures', repositoryName)
  const testRepoPath = temp.mkdirSync('desktop-git-test-')
  FSE.copySync(testRepoFixturePath, testRepoPath)

  FSE.renameSync(
    Path.join(testRepoPath, '_git'),
    Path.join(testRepoPath, '.git')
  )

  const ignoreHiddenFiles = function(item: KlawEntry) {
    const basename = Path.basename(item.path)
    return basename === '.' || basename[0] !== '.'
  }

  const entries: ReadonlyArray<KlawEntry> = klawSync(testRepoPath)
  const visiblePaths = entries.filter(ignoreHiddenFiles)
  const submodules = visiblePaths.filter(
    entry => Path.basename(entry.path) === '_git'
  )

  submodules.forEach(entry => {
    const directory = Path.dirname(entry.path)
    const newPath = Path.join(directory, '.git')
    FSE.renameSync(entry.path, newPath)
  })

  return testRepoPath
}
开发者ID:Aj-ajaam,项目名称:desktop,代码行数:29,代码来源:fixture-helper.ts


示例3: rename

export function rename(src: string, dest: string) {
    // Log.info(`./> mv ${src} ${dest}`);
    try {
        fse.renameSync(src, dest);
    } catch (e) {
        Log.error(`rename: ${e.message}`);
    }
}
开发者ID:VestaRayanAfzar,项目名称:vesta,代码行数:8,代码来源:FsUtil.ts


示例4: catch

 .forEach(file => {
   if (file.endsWith(oldExtension)) {
     try {
       fs.renameSync(file, file.replace(oldExtension, newExtension));
     } catch (error) {
       logger.error(`Failed to rename log file: "${error.message}"`);
     }
   }
 });
开发者ID:wireapp,项目名称:wire-desktop,代码行数:9,代码来源:main.ts


示例5: parseData

						child.on('close', (code: number) => {
							if (errorLine.trim().length > 0) {
								if (errorData) {
									parseData(errorLine.trim());
								}
								else {
									log.error(errorLine.trim());
								}
							}

							if (code === 0) {
								fs.renameSync(temp, to);
								resolve(compiledShader);
							}
							else {
								process.exitCode = 1;
								reject('Shader compiler error.');
							}
						});
开发者ID:jefvel,项目名称:khamake,代码行数:19,代码来源:ShaderCompiler.ts


示例6: resolve

		process.on('close', (code) => {
			if (code !== 0) {
				log.error('kraffiti process exited with code ' + code + ' when trying to convert ' + path.parse(from).name);
				resolve();
				return;
			}

			fs.renameSync(temp, to);
			
			const lines = output.split('\n');
			for (let line of lines) {
				if (line.startsWith('#')) {
					var numbers = line.substring(1).split('x');
					options.original_width = parseInt(numbers[0]);
					options.original_height = parseInt(numbers[1]);
					resolve();
					return;
				}
			}
			resolve();
		});
开发者ID:hammeron-art,项目名称:khamake,代码行数:21,代码来源:ImageTool.ts


示例7: asyncMap

  return await asyncMap(rawImages, (path) => {
    let parts = path.split('.');
    let newPath = "";
    let extension = parts[path.split('.').length -1];
    if (jpgExtensions.indexOf(extension) > -1) {
      parts[path.split('.').length - 1] = 'jpg';
      newPath = parts.join('.');
    } else {
      parts[path.split('.').length - 1] = 'png';
      newPath = parts.join('.');
    }
    if (path !== newPath) {
      let toReturn = newPath;
      path = resolve(basePath, path);
      newPath = resolve(basePath, newPath);
      logger.info(`Renaming ${path} to ${newPath}`);

      renameSync(path, newPath);

      return toReturn;
    } else {
      return path;
    }
  });
开发者ID:tbtimes,项目名称:ledeTwo,代码行数:24,代码来源:imageCommand.ts


示例8:

 submodules.forEach(entry => {
   const directory = Path.dirname(entry.path)
   const newPath = Path.join(directory, '.git')
   FSE.renameSync(entry.path, newPath)
 })
开发者ID:Aj-ajaam,项目名称:desktop,代码行数:5,代码来源:fixture-helper.ts


示例9:

});
fs.ensureSymlink(path, errorCallback);
fs.ensureSymlinkSync(path);
fs.emptyDir(path).then(() => {
	// stub
});
fs.emptyDir(path, errorCallback);
fs.emptyDirSync(path);
fs.pathExists(path).then((_exist: boolean) => {
	// stub
});
fs.pathExists(path, (_err: Error, _exists: boolean) => { });
const x: boolean = fs.pathExistsSync(path);

fs.rename(src, dest, errorCallback);
fs.renameSync(src, dest);
fs.truncate(path, len, errorCallback);
fs.truncateSync(path, len);
fs.chown(path, uid, gid, errorCallback);
fs.chownSync(path, uid, gid);
fs.fchown(fd, uid, gid, errorCallback);
fs.fchownSync(fd, uid, gid);
fs.lchown(path, uid, gid, errorCallback);
fs.lchownSync(path, uid, gid);
fs.chmod(path, modeNum, errorCallback);
fs.chmod(path, modeStr, errorCallback);
fs.chmodSync(path, modeNum);
fs.chmodSync(path, modeStr);
fs.fchmod(fd, modeNum, errorCallback);
fs.fchmod(fd, modeStr, errorCallback);
fs.fchmodSync(fd, modeNum);
开发者ID:gilamran,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts


示例10: pack

    pack(module_name: string, callback: Function) {
        var baseFolder = global.clientAppRoot + "\\modules\\" + module_name + "\\";
        var manifest_file = fs.readJsonSync(baseFolder + consts.MANIFEST_NAME, { throws: false });
        //merge the manifest into the modules.json file
        if (manifest_file === null)
            callback("invalid json, try using ascii file");


        var zip = new JSZip();
        var filesArr: Array<any> = [];
        for (var i = 0; i < manifest_file.files.length; i++) {
            if (fs.existsSync(baseFolder + manifest_file.files[i])) {
                var fileContent = fs.readFileSync(baseFolder + manifest_file.files[i]);
                zip.file(manifest_file.files[i], fileContent);


            }


        }

        if (manifest_file.routes !== undefined) {
            var routeBase: string = serverRoot + "/routes/";
            for (var i = 0; i < manifest_file.routes.length; i++) {
                if (fs.existsSync(routeBase + manifest_file.routes[i].path)) {
                    var fileContent = fs.readFileSync(routeBase + manifest_file.routes[i].path);
                    zip.folder("routes").file(manifest_file.routes[i].path, fileContent);
                }

                var tsfile = routeBase + manifest_file.routes[i].path.replace('.js', '.ts');
                if (fs.existsSync(tsfile)) {
                    var fileContent = fs.readFileSync(tsfile);
                    zip.folder("routes").file(manifest_file.routes[i].path.replace('.js', '.ts'), fileContent);
                }


            }
        }


        if (manifest_file.scripts !== undefined) {
            for (var i = 0; i < manifest_file.scripts.length; i++) {
                if (fs.existsSync(baseFolder + "/scripts/" + manifest_file.scripts[i])) {
                    var fileContent = fs.readFileSync(baseFolder + "/scripts/" + manifest_file.scripts[i]);
                    zip.folder("scripts").file(manifest_file.scripts[i], fileContent);
                }
            }
        }





        if (fs.existsSync(baseFolder + "about.html")) {
            var fileContent = fs.readFileSync(baseFolder + "about.html");
            zip.file("about.html", fileContent);
        }




        var manifestContent = fs.readFileSync(baseFolder + consts.MANIFEST_NAME);
        zip.file(consts.MANIFEST_NAME, manifestContent);


        var content = zip.generate({ type: "nodebuffer" });
        var packageFileName = appRoot + "/nodulus_modules/" + module_name + ".zip";
        var packageBackupFileName = appRoot + "/nodulus_modules/" + module_name + "/" + module_name + "." + this.timestamp() + ".zip";

        if (fs.existsSync(packageFileName)) {
            fs.ensureDirSync(appRoot + "/nodulus_modules/" + module_name);
            fs.renameSync(packageFileName, packageBackupFileName);
        }
    
    
        //var oldPackage  = fs.readFileSync(global.appRoot + "/nodulus_modules/" + module_name + ".zip");
    
        // see FileSaver.js
        fs.writeFile(packageFileName, content, function (err: any) {
            if (err) throw err;
            callback(null, manifest_file);
        });



    }
开发者ID:gitter-badger,项目名称:nodulus,代码行数:86,代码来源:modules.ts



注:本文中的fs-extra.renameSync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra.rmdirSync函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra.rename函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap