source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-core-file-kit\js-apis-file-picker.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { picker } from '@kit.CoreFileKit'; async function example02(context: common.UIAbilityContext) { // Ensure that context is converted from UIAbilityContext. try { let photoSelectOptions = new picker.PhotoSelect...
application-dev\reference\apis-core-file-kit\js-apis-file-picker.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { picker } from '@kit.CoreFileKit'; async function example03(context: common.UIAbilityContext) { // Ensure that context is converted from UIAbilityContext. try { let photoPicker = new picker.PhotoViewPicker(co...
application-dev\reference\apis-core-file-kit\js-apis-file-picker.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { picker } from '@kit.CoreFileKit'; async function example04(context: common.UIAbilityContext) { // Ensure that context is converted from UIAbilityContext. try { let photoSaveOptions = new picker.PhotoSaveOpti...
application-dev\reference\apis-core-file-kit\js-apis-file-picker.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { picker } from '@kit.CoreFileKit'; async function example05(context: common.UIAbilityContext) { // Ensure that context is converted from UIAbilityContext. try { let photoSaveOptions = new picker.PhotoSaveOpti...
application-dev\reference\apis-core-file-kit\js-apis-file-picker.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; import { picker } from '@kit.CoreFileKit'; async function example06(context: common.UIAbilityContext) { // Ensure that context is converted from UIAbilityContext. try { let photoPicker = new picker.PhotoViewPicker(co...
application-dev\reference\apis-core-file-kit\js-apis-file-securityLabel.md
import { securityLabel } from '@kit.CoreFileKit';
application-dev\reference\apis-core-file-kit\js-apis-file-securityLabel.md
import { UIAbility } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; 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-file-securityLabel.md
import { BusinessError } from '@kit.BasicServicesKit'; let filePath = pathDir + '/test.txt'; securityLabel.setSecurityLabel(filePath, "s0").then(() => { console.info("setSecurityLabel successfully"); }).catch((err: BusinessError) => { console.error("setSecurityLabel failed with error message: " + err.mess...
application-dev\reference\apis-core-file-kit\js-apis-file-securityLabel.md
import { BusinessError } from '@kit.BasicServicesKit'; let filePath = pathDir + '/test.txt'; securityLabel.setSecurityLabel(filePath, "s0", (err: BusinessError) => { if (err) { console.error("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { con...
application-dev\reference\apis-core-file-kit\js-apis-file-securityLabel.md
let filePath = pathDir + '/test.txt'; securityLabel.setSecurityLabelSync(filePath, "s0");
application-dev\reference\apis-core-file-kit\js-apis-file-securityLabel.md
import { BusinessError } from '@kit.BasicServicesKit'; let filePath = pathDir + '/test.txt'; securityLabel.getSecurityLabel(filePath).then((type: string) => { console.log("getSecurityLabel successfully, Label: " + type); }).catch((err: BusinessError) => { console.error("getSecurityLabel failed with error ...
application-dev\reference\apis-core-file-kit\js-apis-file-securityLabel.md
import { BusinessError } from '@kit.BasicServicesKit'; let filePath = pathDir + '/test.txt'; securityLabel.getSecurityLabel(filePath, (err: BusinessError, type: string) => { if (err) { console.error("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { ...
application-dev\reference\apis-core-file-kit\js-apis-file-securityLabel.md
let filePath = pathDir + '/test.txt'; let type = securityLabel.getSecurityLabelSync(filePath); console.log("getSecurityLabel successfully, Label: " + type);
application-dev\reference\apis-core-file-kit\js-apis-file-statvfs.md
import { statfs } from '@kit.CoreFileKit';
application-dev\reference\apis-core-file-kit\js-apis-file-statvfs.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; ...
application-dev\reference\apis-core-file-kit\js-apis-file-statvfs.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; ...
application-dev\reference\apis-core-file-kit\js-apis-file-statvfs.md
import { common } from '@kit.AbilityKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let path = context.filesDir; let number = statfs.getFre...
application-dev\reference\apis-core-file-kit\js-apis-file-statvfs.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; ...
application-dev\reference\apis-core-file-kit\js-apis-file-statvfs.md
import { BusinessError } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; ...
application-dev\reference\apis-core-file-kit\js-apis-file-statvfs.md
import { common } from '@kit.AbilityKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let path = context.filesDir; let number = statfs.getTot...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import storageStatistics from "@ohos.file.storageStatistics";
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import volumemanager from "@ohos.file.volumeManager"; import { BusinessError } from '@ohos.base'; volumemanager.getAllVolumes().then((volumes: Array<volumemanager.Volume>) => { let uuid: string = volumes[0].uuid; storageStatistics.getTotalSizeOfVolume(uuid).then((number: number) => { console.info("get...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import volumemanager from "@ohos.file.volumeManager"; import { BusinessError } from '@ohos.base'; volumemanager.getAllVolumes().then((volumes: Array<volumemanager.Volume>) => { let uuid: string = volumes[0].uuid; storageStatistics.getTotalSizeOfVolume(uuid, (error: BusinessError, number: number) => { ...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import volumemanager from "@ohos.file.volumeManager"; import { BusinessError } from '@ohos.base'; volumemanager.getAllVolumes().then((volumes: Array<volumemanager.Volume>) => { let uuid: string = volumes[0].uuid; storageStatistics.getFreeSizeOfVolume(uuid).then((number: number) => { console.info("getF...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import volumemanager from "@ohos.file.volumeManager"; import { BusinessError } from '@ohos.base'; volumemanager.getAllVolumes().then((volumes: Array<volumemanager.Volume>) => { let uuid: string = volumes[0].uuid; storageStatistics.getFreeSizeOfVolume(uuid, (error: BusinessError, number: number) => { i...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import bundleResourceManager from '@ohos.bundle.bundleResourceManager'; import storageStatistics from "@ohos.file.storageStatistics"; import { BusinessError } from '@ohos.base'; import { hilog } from '@kit.PerformanceAnalysisKit'; let bundleName = "com.example.myapplication"; let bundleFlags = bundleResource...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import bundleResourceManager from '@ohos.bundle.bundleResourceManager'; import storageStatistics from "@ohos.file.storageStatistics"; import { BusinessError } from '@ohos.base'; import { hilog } from '@kit.PerformanceAnalysisKit'; let bundleName = "com.example.myapplication"; let bundleFlags = bundleResource...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import { BusinessError } from '@ohos.base'; storageStatistics.getSystemSize().then((number: number) => { console.info("getSystemSize successfully:" + number); }).catch((err: BusinessError) => { console.error("getSystemSize failed with error:" + JSON.stringify(err)); });
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import { BusinessError } from '@ohos.base'; storageStatistics.getSystemSize((error: BusinessError, number: number) => { if (error) { console.error("getSystemSize failed with error:" + JSON.stringify(error)); } else { // Do something. console.info("getSystemSize successfully:" + number); ...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import { BusinessError } from '@ohos.base'; storageStatistics.getUserStorageStats().then((storageStats: storageStatistics.StorageStats) => { console.info("getUserStorageStats successfully:" + JSON.stringify(storageStats)); }).catch((err: BusinessError) => { console.error("getUserStorageStats failed with err...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import { BusinessError } from '@ohos.base'; storageStatistics.getUserStorageStats((error: BusinessError, storageStats: storageStatistics.StorageStats) => { if (error) { console.error("getUserStorageStats failed with error:" + JSON.stringify(error)); } else { // Do something. console.info("ge...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import { BusinessError } from '@ohos.base'; let userId: number = 100; storageStatistics.getUserStorageStats(userId).then((storageStats: storageStatistics.StorageStats) => { console.info("getUserStorageStats successfully:" + JSON.stringify(storageStats)); }).catch((err: BusinessError) => { console.error("g...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics-sys.md
import { BusinessError } from '@ohos.base'; let userId: number = 100; storageStatistics.getUserStorageStats(userId, (error: BusinessError, storageStats: storageStatistics.StorageStats) => { if (error) { console.error("getUserStorageStats failed with error:" + JSON.stringify(error)); } else { // ...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { storageStatistics } from '@kit.CoreFileKit';
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; storageStatistics.getCurrentBundleStats().then((BundleStats: storageStatistics.BundleStats) => { console.info("getCurrentBundleStats successfully:" + JSON.stringify(BundleStats)); }).catch((err: BusinessError) => { console.error("getCurrentBundleStats f...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; storageStatistics.getCurrentBundleStats((error: BusinessError, bundleStats: storageStatistics.BundleStats) => { if (error) { console.error("getCurrentBundleStats failed with error:" + JSON.stringify(error)); } else { // Do something. con...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; storageStatistics.getTotalSize().then((number: number) => { console.info("getTotalSize successfully:" + JSON.stringify(number)); }).catch((err: BusinessError) => { console.error("getTotalSize failed with error:"+ JSON.stringify(err)); });
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; storageStatistics.getTotalSize((error: BusinessError, number: number) => { if (error) { console.error("getTotalSize failed with error:" + JSON.stringify(error)); } else { // Do something. console.info("getTotalSize successfully:" + number); } });
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let number = storageStatistics.getTotalSizeSync(); console.info("getTotalSizeSync successfully:" + JSON.stringify(number)); } catch (err) { let error: BusinessError = err as BusinessError; console.error("getTotalSizeSync failed with error:" + JSON.str...
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; storageStatistics.getFreeSize().then((number: number) => { console.info("getFreeSize successfully:" + JSON.stringify(number)); }).catch((err: BusinessError) => { console.error("getFreeSize failed with error:" + JSON.stringify(err)); });
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; storageStatistics.getFreeSize((error: BusinessError, number: number) => { if (error) { console.error("getFreeSize failed with error:" + JSON.stringify(error)); } else { // Do something. console.info("getFreeSize successfully:" + number); } });
application-dev\reference\apis-core-file-kit\js-apis-file-storage-statistics.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let number = storageStatistics.getFreeSizeSync(); console.info("getFreeSizeSync successfully:" + JSON.stringify(number)); } catch (err) { let error: BusinessError = err as BusinessError; console.error("getFreeSizeSync failed with error:" + JSON.string...
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import volumemanager from "@ohos.file.volumeManager";
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; volumemanager.getAllVolumes().then((volumes: Array<volumemanager.Volume>) => { // do something with volumes, which is an array }).catch((error: BusinessError) => { console.error("getAllVolumes failed"); });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; volumemanager.getAllVolumes((error: BusinessError, volumes: Array<volumemanager.Volume>) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; volumemanager.mount(volumeId).then(() => { // Do something. }).catch((error: BusinessError) => { console.error("mount failed"); });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; volumemanager.mount(volumeId, (error: BusinessError) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; volumemanager.unmount(volumeId).then(() => { // Do something. }).catch((error: BusinessError) => { console.error("mount failed"); });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; volumemanager.unmount(volumeId, (error: BusinessError) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let uuid: string = ""; volumemanager.getVolumeByUuid(uuid).then((volume: volumemanager.Volume) => { console.info("getVolumeByUuid successfully:" + JSON.stringify(volume)); }).catch((error: BusinessError) => { console.error("getVolumeByUuid failed with error:" + ...
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let uuid: string = ""; volumemanager.getVolumeByUuid(uuid, (error: BusinessError, volume: volumemanager.Volume) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; volumemanager.getVolumeById(volumeId).then((volume: volumemanager.Volume) => { console.info("getVolumeById successfully:" + JSON.stringify(volume)); }).catch((error: BusinessError) => { console.error("getVolumeById failed with error:" ...
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; volumemanager.getVolumeById(volumeId, (error: BusinessError, volume: volumemanager.Volume) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let uuid: string = ""; let description: string = ""; volumemanager.setVolumeDescription(uuid, description).then(() => { console.info("setVolumeDescription successfully"); }).catch((error: BusinessError) => { console.error("setVolumeDescription failed with erro...
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let uuid: string = ""; let description: string = ""; volumemanager.setVolumeDescription(uuid, description, (error: BusinessError) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; let fsType: string = ""; volumemanager.format(volumeId, fsType).then(() => { console.info("format successfully"); }).catch((error: BusinessError) => { console.error("format failed with error:" + JSON.stringify(error)); });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let volumeId: string = ""; let fsType: string = ""; volumemanager.format(volumeId, fsType, (error: BusinessError) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let diskId: string = ""; let type: number = 0; volumemanager.partition(diskId, type).then(() => { console.info("partition successfully"); }).catch((error: BusinessError) => { console.error("partition failed with error:" + JSON.stringify(error)); });
application-dev\reference\apis-core-file-kit\js-apis-file-volumemanager-sys.md
import { BusinessError } from '@ohos.base'; let diskId: string = ""; let type: number = 0; volumemanager.partition(diskId, type, (error: BusinessError) => { // Do something. });
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import fileAccess from '@ohos.file.fileAccess';
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; import Want from '@ohos.app.ability.Want'; async function getFileAccessAbilityInfo() { let wantInfos: Array<Want> = []; try { wantInfos = await fileAccess.getFileAccessAbilityInfo(); console.log("getFileAccessAbilityInfo data " + JSON.stringify(wantInf...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; import Want from '@ohos.app.ability.Want'; async function getFileAccessAbilityInfo() { try { fileAccess.getFileAccessAbilityInfo((err: BusinessError, wantInfos: Array<Want>) => { if (err) { console.error("Failed to getFileAccessAbilityInfo in a...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; import Want from '@ohos.app.ability.Want'; import common from '@ohos.app.ability.common'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostCo...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; import common from '@ohos.app.ability.common'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; functi...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; // fileInfoDir indicates information about a directory. // let filter = { suffix : [".txt", ".jpg", ".xlsx"] }; let fileInfoDir :Array<fileAccess.FileInfo> = []; let subfileInfos: Array<fileAccess.FileInfo> = []; let isDone: boolean = false; try { for (let i =...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; // fileInfoDir indicates information about a directory. // let filter = {suffix : [".txt", ".jpg", ".xlsx"]}; let fileInfoDir: Array<fileAccess.FileInfo> = []; let subfileInfos: Array<fileAccess.FileInfo> = []; let isDone: boolean = false; try { for (let i = 0...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; // rootInfo can be obtained by getRoots(). // let filter = {suffix : [".txt", ".jpg", ".xlsx"]}; let rootInfo: Array<fileAccess.FileInfo> = []; let fileInfos: Array<fileAccess.FileInfo> = []; let isDone: boolean = false; try { for (let i = 0; i < rootInfo.leng...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; // rootInfo can be obtained by getRoots(). // let filter = {suffix : [".txt", ".jpg", ".xlsx"]}; let rootInfo: Array<fileAccess.FileInfo> = []; let fileInfos: Array<fileAccess.FileInfo> = []; let isDone: boolean = false; try { for (let i = 0; i < rootInfo.leng...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
async function getRoots() { let rootIterator: fileAccess.RootIterator; let rootinfos: Array<fileAccess.RootInfo> = []; let isDone: boolean = false; // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. let fileAccessHelper : fileAccess.FileAccessHelper|undefined; t...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; async function getRoots() { let rootinfos: Array<fileAccess.RootInfo> = []; let isDone: boolean = false; // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. let fileAccessHelper : fileAccess.FileAccessHelper|undef...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; async function createFile() { // A built-in storage directory is used as an example. // In the sample code, sourceUri indicates the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceUri: string = "file://docs/stor...
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 indicates the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceUri: string = "file://docs/storage/Users/currentUser/Download"; let d...
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 indicates the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. async function createDirectory() { let sourceUri: string = "file://docs/stora...
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 indicates the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceUri: string = "file://docs/storage/Users/currentUser/Download"; let d...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; async function openFile01() { // A built-in storage directory is used as an example. // In the sample code, targetUri indicates a file in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let targetUri: string = "file:/...
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, targetUri indicates a file in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let targetUri: string = "file://docs/storage/Users/currentUser/Download...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; async function deleteFile01() { // A built-in storage directory is used as an example. // In the sample code, targetUri indicates a file in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let targetUri: string = "file...
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, targetUri indicates a file in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let targetUri: string = "file://docs/storage/Users/currentUser/Download...
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, sourceFile and destFile indicate the files and directories in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. ...
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 and destFile indicate the files and directories in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceFile: string = "file://docs/s...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; async function renameFile01() { // A built-in storage directory is used as an example. // In the sample code, sourceDir indicates a file in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceDir: string = "file...
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, sourceDir indicates a file in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceDir: string = "file://docs/storage/Users/currentUser/Download...
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, sourceDir indicates a file in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. async function accessFunc() { let sourceDir: string = "file://docs/...
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, sourceDir indicates a directory in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceDir: string = "file://docs/storage/Users/currentUser/Dow...
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 indicates the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. async function getUri() { let sourceUri: string = "file://docs/storage/Users/...
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 indicates the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceUri: string = "file://docs/storage/Users/currentUser/Download"; // Ob...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; // In the sample code, relativePath indicates the Download directory, which is the relativePath in fileInfo. // You can use the relativePath obtained. async function getRelativePath() { let relativePath: string = "Download/"; // Obtain fileAccessHelper by referr...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; // In the sample code, relativePath indicates the Download directory, which is the relativePath in fileInfo. // You can use the relativePath obtained. let relativePath: string = "Download/"; // Obtain fileAccessHelper by referring to the sample code of fileAccess.crea...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; async function getQuery01() { let imageFileRelativePath: string = "/storage/Users/currentUser/Download/queryTest/image/01.jpg"; let jsonStrSingleRelativepath: string = JSON.stringify({ [fileAccess.FileKey.RELATIVE_PATH]: "" }); // Obtain fileAccessHelper by referring to...
application-dev\reference\apis-core-file-kit\js-apis-fileAccess-sys.md
import { BusinessError } from '@ohos.base'; async function getQuery02() { let imageFileRelativePath: string = "/storage/Users/currentUser/Download/queryTest/image/01.jpg"; let jsonStrSingleRelativepath: string = JSON.stringify({ [fileAccess.FileKey.RELATIVE_PATH]: "" }); // Obtain fileAccessHelper by referring to...
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'; // 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 registerObserver01() { 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 registerObserver02() { 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 registerObserver03() { 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...