本文整理匯總了TypeScript中q-io/fs.list函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript list函數的具體用法?TypeScript list怎麽用?TypeScript list使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了list函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getDirs
function getDirs(src:string):Q.Promise<string[]> {
src = path.resolve(src);
var ret:string[] = [];
var d:Q.Deferred<string[]> = Q.defer();
FS.list(src).then((names:string[]) => {
return Q.all(names.map((name:string) => {
return FS.isDirectory(path.join(src, name)).then((isDir:boolean) => {
if (!isDir) {
return;
}
ret.push(name);
});
}));
}).then(() => {
d.resolve(ret);
}, d.reject);
return d.promise;
}
示例2:
//TODO how to define the multiple return types? use any for now?
anyQ = fs.read(path, options);
//strQ = fs.read(path, options);
//fs.read(path, options):Q.Promise<NodeBuffer>;
voidQ = fs.write(path, buffer, options);
voidQ = fs.write(path, str, options);
voidQ = fs.append(path, buffer, options);
voidQ = fs.append(path, str, options);
voidQ = fs.copy(source, target);
voidQ = fs.copyTree(source, target);
strArrQ = fs.list(path);
strArrQ = fs.listTree(path, (path, x) => {
return true;
});
strArrQ = fs.listDirectoryTree(path);
voidQ = fs.makeDirectory(path, str);
voidQ = fs.makeDirectory(path, num);
voidQ = fs.makeTree(path, str);
voidQ = fs.makeTree(path, num);
voidQ = fs.remove(path);
voidQ = fs.removeTree(path);
voidQ = fs.rename(source, target);
voidQ = fs.move(source, target);