source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
async function UnregisterObserver01() {
let DirUri: string = 'file://docs/storage/Users/currentUser/Documents';
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
let fileAccessHelper : fileAccess.FileAccessHelper|undefined;... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
async function UnregisterObserver02() {
let DirUri: string = 'file://docs/storage/Users/currentUser/Documents';
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
let fileAccessHelper : fileAccess.FileAccessHelper|undefined;... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
async function UnregisterObserver03() {
let DirUri: string = 'file://docs/storage/Users/currentUser/Documents';
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
let fileAccessHelper : fileAccess.FileAccessHelper|undefined;... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
async function UnregisterObserver03() {
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
let fileAccessHelper : fileAccess.FileAccessHelper|undefined;
try {
const callbackDir1 = (NotifyMessageDir: fileAccess.NotifyMess... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and URI is the URI in fileInfo.
// You can use th... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and URI is the URI in fileInfo.
// You can use th... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and URI is the URI in fileInfo.
// You can use th... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and URI is the URI in fileInfo.
// You can use th... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
async function moveFile01() {
// A built-in storage directory is used as an example.
// In the sample code, sourceUri and destUri indicate the files or directories in the Download directory. The URI is the URI in fileInfo.
// You can use the URI obtained.
le... |
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md | import { BusinessError } from '@ohos.base';
// A built-in storage directory is used as an example.
// In the sample code, sourceUri and destUri indicate the files or directories in the Download directory. The URI is the URI in fileInfo.
// You can use the URI obtained.
let sourceUri: string = "file://docs/stora... |
application-dev\reference\apis-core-file-kit\js-apis-fileExtensionInfo-sys.md | import fileExtensionInfo from '@ohos.file.fileExtensionInfo'; |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import fileio from '@ohos.fileio'; |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window';
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage: window.WindowStage) {
let context = this.context;
let pathDir = context.filesDir;
}
} |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "test.txt";
fileio.stat(filePath).then((stat: fileio.Stat) => {
console.info("getFileInfo succeed, the size of file is " + stat.size);
}).catch((err: BusinessError) => {
console.error("getFileInfo failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
fileio.stat(pathDir, (err: BusinessError, stat: fileio.Stat) => {
// Example code in Stat
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let stat = fileio.statSync(pathDir);
// Example code in Stat |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let dirPath = pathDir + "/testDir";
fileio.opendir(dirPath).then((dir: fileio.Dir) => {
console.info("opendir succeed");
}).catch((err: BusinessError) => {
console.error("opendir failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
fileio.opendir(pathDir, (err: BusinessError, dir: fileio.Dir) => {
// Example code in Dir struct
// Use read/readSync/close.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let dir = fileio.opendirSync(pathDir);
// Example code in Dir struct
// Use read/readSync/close. |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.access(filePath).then(() => {
console.info("Access successful");
}).catch((err: BusinessError) => {
console.error("access failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.access(filePath, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
try {
fileio.accessSync(filePath);
} catch(error) {
let err: BusinessError = error as BusinessError;
console.error("accessSync failed with error:" + err);
} |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.close(fd).then(() => {
console.info("File closed");
}).catch((err: BusinessError) => {
console.error("close file failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.close(fd, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.closeSync(fd); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let srcPath = pathDir + "srcDir/test.txt";
let dstPath = pathDir + "dstDir/test.txt";
fileio.copyFile(srcPath, dstPath).then(() => {
console.info("File copied");
}).catch((err: BusinessError) => {
console.error("copyFile failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let srcPath = pathDir + "srcDir/test.txt";
let dstPath = pathDir + "dstDir/test.txt";
fileio.copyFile(srcPath, dstPath, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let srcPath = pathDir + "srcDir/test.txt";
let dstPath = pathDir + "dstDir/test.txt";
fileio.copyFileSync(srcPath, dstPath); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let dirPath = pathDir + '/testDir';
fileio.mkdir(dirPath).then(() => {
console.info("Directory created");
}).catch((error: BusinessError) => {
console.error("mkdir failed with error:" + error);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let dirPath = pathDir + '/testDir';
fileio.mkdir(dirPath, (err: BusinessError) => {
console.info("Directory created");
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let dirPath = pathDir + '/testDir';
fileio.mkdirSync(dirPath); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.open(filePath, 0o1, 0o0200).then((number: number) => {
console.info("File opened");
}).catch((err: BusinessError) => {
console.error("open file failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.open(filePath, 0, (err: BusinessError, fd: number) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o102, 0o640); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o102, 0o666);
fileio.writeSync(fd, 'hello world');
let fd1 = fileio.openSync(filePath, 0o2002);
fileio.writeSync(fd1, 'hello world');
class Option {
offset: number = 0;
length: number = 4096;
position: number = 0;
}
let ... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
import buffer from '@ohos.buffer';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o102, 0o640);
let arrayBuffer = new ArrayBuffer(4096);
fileio.read(fd, arrayBuffer).then((readResult: fileio.ReadOut) => {
console.info("Read file data s... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
import buffer from '@ohos.buffer';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o102, 0o640);
let arrayBuffer = new ArrayBuffer(4096);
fileio.read(fd, arrayBuffer, (err: BusinessError, readResult: fileio.ReadOut) => {
if (readResult)... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o2);
let buf = new ArrayBuffer(4096);
let num = fileio.readSync(fd, buf); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let dirPath = pathDir + '/testDir';
fileio.rmdir(dirPath).then(() => {
console.info("Directory removed");
}).catch((err: BusinessError) => {
console.error("rmdir failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let dirPath = pathDir + '/testDir';
fileio.rmdir(dirPath, (err: BusinessError) => {
// Do something.
console.info("Directory removed");
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let dirPath = pathDir + '/testDir';
fileio.rmdirSync(dirPath); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.unlink(filePath).then(() => {
console.info("File removed");
}).catch((error: BusinessError) => {
console.error("remove file failed with error:" + error);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.unlink(filePath, (err: BusinessError) => {
console.info("File removed");
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
fileio.unlinkSync(filePath); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o100 | 0o2, 0o666);
fileio.write(fd, "hello, world").then((number: number) => {
console.info("write data to file succeed and size is:" + number);
}).catch((err: BusinessError) => {
conso... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o100 | 0o2, 0o666);
fileio.write(fd, "hello, world", (err: BusinessError, bytesWritten: number) => {
if (bytesWritten) {
console.info("write data to file succeed and size is:" + bytesWri... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath, 0o100 | 0o2, 0o666);
let num = fileio.writeSync(fd, "hello, world"); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.hash(filePath, "sha256").then((str: string) => {
console.info("calculate file hash succeed:" + str);
}).catch((err: BusinessError) => {
console.error("calculate file hash failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.hash(filePath, "sha256", (err: BusinessError, hashStr: string) => {
if (hashStr) {
console.info("calculate file hash succeed:" + hashStr);
}
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.chmod(filePath, 0o700).then(() => {
console.info("File permissions changed");
}).catch((err: BusinessError) => {
console.error("chmod failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.chmod(filePath, 0o700, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
fileio.chmodSync(filePath, 0o700); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fstat(fd).then((stat: fileio.Stat) => {
console.info("fstat succeed, the size of file is " + stat.size);
}).catch((err: BusinessError) => {
console.error("fstat failed with error:... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fstat(fd, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let stat = fileio.fstatSync(fd); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.ftruncate(fd, 5).then(() => {
console.info("File truncated");
}).catch((err: BusinessError) => {
console.error("truncate file failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let len = 5;
fileio.ftruncate(fd, 5, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let len = 5;
fileio.ftruncateSync(fd, len); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let len = 5;
fileio.truncate(filePath, len).then(() => {
console.info("File truncated");
}).catch((err: BusinessError) => {
console.error("truncate file failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let len = 5;
fileio.truncate(filePath, len, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let len = 5;
fileio.truncateSync(filePath, len); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.readText(filePath).then((str: string) => {
console.info("readText succeed:" + str);
}).catch((err: BusinessError) => {
console.error("readText failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
class Option {
length: number = 4096;
position: number = 0;
encoding: string = 'utf-8';
}
let option = new Option();
option.position = 1;
option.encoding = 'utf-8';
fileio.readText(filePath, option, (err: Busines... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
class Option {
length: number = 4096;
position: number = 0;
encoding: string = 'utf-8';
}
let option = new Option();
option.position = 1;
option.length = 3;
let str = fileio.readTextSync(filePath, option); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.lstat(filePath).then((stat: fileio.Stat) => {
console.info("get link status succeed, the size of file is" + stat.size);
}).catch((err: BusinessError) => {
console.error("get link status failed with error:" + err);
}... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.lstat(filePath, (err: BusinessError, stat: fileio.Stat) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let stat = fileio.lstatSync(filePath); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let srcFile = pathDir + "/test.txt";
let dstFile = pathDir + '/new.txt';
fileio.rename(srcFile, dstFile).then(() => {
console.info("File renamed");
}).catch((err: BusinessError) => {
console.error("rename failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let srcFile = pathDir + "/test.txt";
let dstFile = pathDir + '/new.txt';
fileio.rename(srcFile, dstFile, (err: BusinessError) => {
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let srcFile = pathDir + "/test.txt";
let dstFile = pathDir + '/new.txt';
fileio.renameSync(srcFile, dstFile); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fsync(fd).then(() => {
console.info("sync data succeed");
}).catch((err: BusinessError) => {
console.error("sync data failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fsync(fd, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fsyncSync(fd); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fdatasync(fd).then(() => {
console.info("sync data succeed");
}).catch((err: BusinessError) => {
console.error("sync data failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fdatasync (fd, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let stat = fileio.fdatasyncSync(fd); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let srcFile = pathDir + "/test.txt";
let dstFile = pathDir + '/test';
fileio.symlink(srcFile, dstFile).then(() => {
console.info("Symbolic link created");
}).catch((err: BusinessError) => {
console.error("symlink failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let srcFile = pathDir + "/test.txt";
let dstFile = pathDir + '/test';
fileio.symlink(srcFile, dstFile, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let srcFile = pathDir + "/test.txt";
let dstFile = pathDir + '/test';
fileio.symlinkSync(srcFile, dstFile); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let stat = fileio.statSync(filePath);
fileio.chown(filePath, stat.uid, stat.gid).then(() => {
console.info("File owner changed");
}).catch((err: BusinessError) => {
console.error("chown failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let stat = fileio.statSync(filePath)
fileio.chown(filePath, stat.uid, stat.gid, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let stat = fileio.statSync(filePath)
fileio.chownSync(filePath, stat.uid, stat.gid); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
fileio.mkdtemp(pathDir + "/XXXXXX").then((pathDir: string) => {
console.info("mkdtemp succeed:" + pathDir);
}).catch((err: BusinessError) => {
console.error("mkdtemp failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
fileio.mkdtemp(pathDir + "/XXXXXX", (err: BusinessError, res: string) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let res = fileio.mkdtempSync(pathDir + "/XXXXXX"); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let mode: number = 0o700;
fileio.fchmod(fd, mode).then(() => {
console.info("File permissions changed");
}).catch((err: BusinessError) => {
console.error("chmod failed with error:" + e... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let mode: number = 0o700;
fileio.fchmod(fd, mode, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let mode: number = 0o700;
fileio.fchmodSync(fd, mode); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.createStream(filePath, "r+").then((stream: fileio.Stream) => {
console.info("Stream created");
}).catch((err: BusinessError) => {
console.error("createStream failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
fileio.createStream(filePath, "r+", (err: BusinessError, stream: fileio.Stream) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let ss = fileio.createStreamSync(filePath, "r+"); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fdopenStream(fd, "r+").then((stream: fileio.Stream) => {
console.info("Stream opened");
}).catch((err: BusinessError) => {
console.error("openStream failed with error:" + err);
... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
fileio.fdopenStream(fd, "r+", (err: BusinessError, stream: fileio.Stream) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let ss = fileio.fdopenStreamSync(fd, "r+"); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let stat = fileio.statSync(filePath);
fileio.fchown(fd, stat.uid, stat.gid).then(() => {
console.info("File owner changed");
}).catch((err: BusinessError) => {
console.error("chown fai... |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let stat = fileio.statSync(filePath);
fileio.fchown(fd, stat.uid, stat.gid, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let fd = fileio.openSync(filePath);
let stat = fileio.statSync(filePath);
fileio.fchownSync(fd, stat.uid, stat.gid); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let stat = fileio.statSync(filePath);
fileio.lchown(filePath, stat.uid, stat.gid).then(() => {
console.info("File owner changed");
}).catch((err: BusinessError) => {
console.error("chown failed with error:" + err);
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | import { BusinessError } from '@ohos.base';
let filePath = pathDir + "/test.txt";
let stat = fileio.statSync(filePath);
fileio.lchown(filePath, stat.uid, stat.gid, (err: BusinessError) => {
// Do something.
}); |
application-dev\reference\apis-core-file-kit\js-apis-fileio.md | let filePath = pathDir + "/test.txt";
let stat = fileio.statSync(filePath);
fileio.lchownSync(filePath, stat.uid, stat.gid); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.