fs#access TypeScript Examples
The following examples show how to use
fs#access.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilesystemChecker.ts From Bridge with GNU General Public License v3.0 | 6 votes |
/**
* Verifies that the user has specified a library folder.
*/
private checkLibraryFolder() {
if (getSettings().libraryPath == undefined) {
this.callbacks.error(filesystemErrors.libraryFolder(), () => this.beginCheck())
} else {
access(getSettings().libraryPath, constants.W_OK, this.cancelable((err) => {
if (err) {
this.callbacks.error(filesystemErrors.libraryAccess(err), () => this.beginCheck())
} else {
this.checkDestinationFolder()
}
}))
}
}
Example #2
Source File: FilesystemChecker.ts From Bridge with GNU General Public License v3.0 | 6 votes |
/**
* Checks that the destination folder doesn't already exist.
*/
private checkDestinationFolder() {
const destinationPath = join(getSettings().libraryPath, this.destinationFolderName)
access(destinationPath, constants.F_OK, this.cancelable((err) => {
if (err) { // File does not exist
this.createDownloadFolder()
} else {
this.callbacks.error(filesystemErrors.destinationFolderExists(destinationPath), () => this.beginCheck())
}
}))
}
Example #3
Source File: Generator.ts From graphql-ts-client with MIT License | 5 votes |
accessAsync = promisify(access)