本文整理匯總了TypeScript中q-io/fs.exists函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript exists函數的具體用法?TypeScript exists怎麽用?TypeScript exists使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了exists函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: printTailAndWatchFile
async function printTailAndWatchFile(file:any, tailSize:number) {
if (await qfs.exists(file)) {
const content = await qfs.read(file)
const lines = content.split('\n')
const from = Math.max(0, lines.length - tailSize)
const lastLines = lines.slice(from).join('\n')
console.log(lastLines)
}
watchFile(file)
}
示例2: async
getHomeParams: async (isMemory:boolean, theHome:string) => {
const params:any = await dir.getHomeFS(isMemory, theHome)
const home = params.home;
if (isMemory) {
params.dbf = () => new SQLiteDriver(':memory:');
params.wotb = WoTBObject.memoryInstance();
} else {
const sqlitePath = path.join(home, dir.DUNITER_DB_NAME + '.db');
params.dbf = () => new SQLiteDriver(sqlitePath);
const wotbFilePath = path.join(home, dir.WOTB_FILE);
let existsFile = await qfs.exists(wotbFilePath)
if (!existsFile) {
fs.closeSync(fs.openSync(wotbFilePath, 'w'));
}
params.wotb = WoTBObject.fileInstance(wotbFilePath);
}
return params;
},
示例3:
return this.core.content.loadContent(file).progress(d.notify).then(() => {
// check again? (race?)
return FS.exists(targetPath);
}).then((exists) => {
示例4:
voidQ = fs.move(source, target);
voidQ = fs.link(source, target);
voidQ = fs.symbolicCopy(source, target, type);
voidQ = fs.symbolicLink(target, str, type);
voidQ = fs.chown(path, num, num);
voidQ = fs.chmod(path, str);
voidQ = fs.chmod(path, num);
statsQ = fs.stat(path)
statsQ = fs.statLink(path);
statsQ = fs.statFd(num);
boolQ = fs.exists(path);
boolQ = fs.isFile(path);
boolQ = fs.isDirectory(path);
boolQ = fs.isSymbolicLink(path);
dateQ = fs.lastModified(path);
dateQ = fs.lastAccessed(path);
strArr = fs.split(path);
str = fs.join(str, str);
str = fs.join(strArr);
str = fs.resolve(str, str);
str = fs.resolve(strArr);
str = fs.normal(str, str);
str = fs.normal(strArr);