diff --git a/interfaces/kits/js/napi/@ohos.document.d.ts b/interfaces/kits/js/napi/@ohos.document.d.ts deleted file mode 100644 index 88df1e0cfde75ca6f7ae55ea9ea1645e0ba2b3be..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/napi/@ohos.document.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AsyncCallback } from './basic' - -export default document; - -/** - * document - * @syscap SystemCapability.FileManagement.UserFileService - * @since 6 - * @import import document from '@ohos.document'; - * @permission N/A - */ -declare namespace document { - export { choose }; - export { show }; -} - -/** - * choose. - * - * @note N/A - * @syscap SystemCapability.FileManagement.UserFileService - * @since 6 - * @permission N/A - * @function choose - * @param {string} type - type. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function choose(types?: string[]): Promise; -declare function choose(callback: AsyncCallback): void; -declare function choose(types: string[], callback: AsyncCallback): void; - -/** - * show. - * - * @note N/A - * @syscap SystemCapability.FileManagement.UserFileService - * @since 6 - * @permission N/A - * @function show - * @param {string} uri - uri. - * @param {string} type - type. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function show(uri: string, type: string): Promise; -declare function show(uri: string, type: string, callback: AsyncCallback): void; \ No newline at end of file diff --git a/interfaces/kits/js/napi/@ohos.environment.d.ts b/interfaces/kits/js/napi/@ohos.environment.d.ts deleted file mode 100644 index 4ecb978046047db3a38db777c70b537bc8d6b874..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/napi/@ohos.environment.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback, Callback} from "./basic"; - -/** - * Provides Environment APIs. - * - * @since 8 - * @syscap SystemCapability.FileManagement.File.Environment - */ -declare namespace Environment { - /** - * Get the user data path. - * - * @since 8 - */ - function getStorageDataDir(callback: AsyncCallback): void; - function getStorageDataDir(): Promise; - /** - * Get the User storage path. - * - * @since 8 - */ - function getUserDataDir(callback: AsyncCallback): void; - function getUserDataDir(): Promise; -} - -export default Environment; diff --git a/interfaces/kits/js/napi/@ohos.fileio.d.ts b/interfaces/kits/js/napi/@ohos.fileio.d.ts deleted file mode 100644 index d074897db66b2d0b83bb97b2901da646653e741e..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/napi/@ohos.fileio.d.ts +++ /dev/null @@ -1,1548 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { AsyncCallback } from './basic' - -export default fileIO; - -/** - * fileio - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @import import fileio from '@ohos.fileio'; - * @permission N/A - */ -declare namespace fileIO { - export { access }; - export { accessSync }; - export { chmod }; - export { chmodSync }; - export { chown }; - export { chownSync }; - export { close }; - export { closeSync }; - export { copyFile }; - export { copyFileSync }; - export { createStream }; - export { createStreamSync }; - export { createWatcher }; - export { fchmod }; - export { fchmodSync }; - export { fchown }; - export { fchownSync }; - export { fdatasync }; - export { fdatasyncSync }; - export { fdopenStream }; - export { fdopenStreamSync }; - export { fstat }; - export { fstatSync }; - export { fsync }; - export { fsyncSync }; - export { ftruncate }; - export { ftruncateSync }; - export { hash }; - export { lchown }; - export { lchownSync }; - export { lstat }; - export { lstatSync }; - export { mkdir }; - export { mkdirSync }; - export { mkdtemp }; - export { mkdtempSync }; - export { open }; - export { openSync }; - export { opendir }; - export { opendirSync }; - export { read }; - export { readSync }; - export { readText }; - export { readTextSync }; - export { rename }; - export { renameSync }; - export { rmdir }; - export { rmdirSync }; - export { stat }; - export { statSync }; - export { symlink }; - export { symlinkSync }; - export { truncate }; - export { truncateSync }; - export { unlink }; - export { unlinkSync }; - export { write }; - export { writeSync }; - export { Dir }; - export { Dirent }; - export { ReadOut }; - export { Stat }; - export { Stream }; - export { Watcher }; -} - -/** - * access. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function access - * @param {string} path - path. - * @param {number} [mode = 0] - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function access(path: string, mode?: number): Promise; -declare function access(path: string, callback: AsyncCallback): void; -declare function access(path: string, mode: number, callback: AsyncCallback): void; -/** - * accessSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function accessSync - * @param {string} path - path. - * @param {number} [mode = 0] - mode. - * @returns {void} access success - * @throws {TypedError | Error} access fail - */ -declare function accessSync(path: string, mode?: number): void; -/** - * close. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function close - * @param {number} fd - fd. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function close(fd: number): Promise; -declare function close(fd: number, callback: AsyncCallback): void; -/** - * closeSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function closeSync - * @param {number} fd - fd. - * @returns {void} close success - * @throws {TypedError | Error} close fail - */ -declare function closeSync(fd: number): void; -/** - * copyFile. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function copyFile - * @param {string | number} src - src. - * @param {string | number} dest - dest. - * @param {number} [mode = 0] - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function copyFile(src: string | number, dest: string | number, mode?: number): Promise; -declare function copyFile(src: string | number, dest: string | number, callback: AsyncCallback): void; -declare function copyFile(src: string | number, dest: string | number, mode: number, callback: AsyncCallback): void; -/** - * copyFileSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function copyFileSync - * @param {string | number} src - src. - * @param {string | number} dest - dest. - * @param {number} [mode = 0] - mode. - * @returns {void} copyFile success - * @throws {TypedError | Error} copyFile fail - */ -declare function copyFileSync(src: string | number, dest: string | number, mode?: number): void; -/** - * createStream. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function createStream - * @param {string} path - path. - * @param {string} mode - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return Stream - * @throws {TypedError} Parameter check failed - */ -declare function createStream(path: string, mode: string): Promise; -declare function createStream(path: string, mode: string, callback: AsyncCallback): void; -/** - * createStreamSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function createStreamSync - * @param {string} path - path. - * @param {string} mode - mode. - * @returns {Stream} createStream - * @throws {TypedError} Parameter check failed - */ -declare function createStreamSync(path: string, mode: string): Stream; -/** - * chown. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function appendFile - * @param {string} path - path. - * @param {number} uid - mode. - * @param {number} gid - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function chown(path: string, uid: number, gid: number): Promise; -declare function chown(path: string, uid: number, gid: number, callback: AsyncCallback): void; -/** - * chownSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function appendFile - * @param {string} path - path. - * @param {number} uid - mode. - * @param {number} gid - mode. - * @returns {void} chown success - * @throws {TypedError | Error} chown fail - */ -declare function chownSync(path: string, uid: number, gid: number): void; -/** - * chmod. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function chmod - * @param {string} path - path. - * @param {number} mode - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function chmod(path: string, mode: number): Promise; -declare function chmod(path: string, mode: number, callback: AsyncCallback): void; -/** - * chmodSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function chmodSync - * @param {string} path - path. - * @param {number} mode - mode. - * @returns {void} chmod success - * @throws {TypedError | Error} chmod fail - */ -declare function chmodSync(path: string, mode: number): void; -/** - * ftruncate. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function ftruncate - * @param {number} fd - fd. - * @param {number} [len = 0] - len. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function ftruncate(fd: number, len?: number): Promise; -declare function ftruncate(fd: number, callback: AsyncCallback): void; -declare function ftruncate(fd: number, len: number, callback: AsyncCallback): void; -/** - * ftruncateSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function ftruncateSync - * @param {number} fd - fd. - * @param {number} [len = 0] - len. - * @returns {void} ftruncate success - * @throws {TypedError | Error} ftruncate fail - */ -declare function ftruncateSync(fd: number, len?: number): void; -/** - * fsync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fsync - * @param {number} fd - fd. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function fsync(fd: number): Promise; -declare function fsync(fd: number, callback: AsyncCallback): void; -/** - * fsyncSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fsyncSync - * @param {number} fd - fd. - * @returns {void} fsync success - * @throws {TypedError | Error} fsync fail - */ -declare function fsyncSync(fd: number): void; -/** - * fstat. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fstat - * @param {number} fd - fd. - * @returns {Stat} - * @throws {TypedError | Error} fstat fail - */ -declare function fstat(fd: number): Promise; -declare function fstat(fd: number, callback: AsyncCallback): void; -/** - * fstatSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fstatSync - * @param {number} fd - fd. - * @returns {Stat} - * @throws {TypedError | Error} fstat fail - */ -declare function fstatSync(fd: number): Stat; -/** - * fdatasync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fdatasync - * @param {number} fd - fd. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function fdatasync(fd: number): Promise; -declare function fdatasync(fd: number, callback: AsyncCallback): void; -/** - * fdatasyncSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fdatasyncSync - * @param {number} fd - fd. - * @returns {void} fdatasync success - * @throws {TypedError | Error} fdatasync fail - */ -declare function fdatasyncSync(fd: number): void; -/** - * fchown. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fchown - * @param {number} fd - fd. - * @param {number} uid - uid. - * @param {number} gid - gid. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function fchown(fd: number, uid: number, gid: number): Promise; -declare function fchown(fd: number, uid: number, gid: number, callback: AsyncCallback): void; -/** - * fchownSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fchownSync - * @param {number} fd - fd. - * @param {number} uid - uid. - * @param {number} gid - gid. - * @returns {void} fchown success - * @throws {TypedError | Error} fchown fail - */ -declare function fchownSync(fd: number, uid: number, gid: number): void; -/** - * fchmod. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fchmod - * @param {number} fd - fd. - * @param {number} mode - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function fchmod(fd: number, mode: number): Promise; -declare function fchmod(fd: number, mode: number, callback: AsyncCallback): void; -/** - * fchmodSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fchmodSync - * @param {number} fd - fd. - * @param {number} mode - mode. - * @returns {void} fchmod success - * @throws {TypedError | Error} fchmod fail - */ -declare function fchmodSync(fd: number, mode: number): void; -/** - * fdopenStream. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fdopenStream - * @param {number} fd - fd. - * @param {string} mode - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function fdopenStream(fd: number, mode: string): Promise; -declare function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void; -/** - * fdopenStreamSync. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function fdopenStreamSync - * @param {number} fd - fd. - * @param {string} mode - mode. - * @returns {Stream} open stream from fd - * @throws {TypedError | Error} open fail - */ -declare function fdopenStreamSync(fd: number, mode: string): Stream; - /** - * hash. - * @static - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function hash - * @param {string} path - path. - * @param {string} algorithm - algorithm md5 sha1 sha256. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function hash(path: string, algorithm: string): Promise; -declare function hash(path: string, algorithm: string, callback: AsyncCallback): void; -/** - * lchown. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function lchown - * @param {string} path - path. - * @param {number} uid - uid. - * @param {number} gid - gid. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function lchown(path: string, uid: number, gid: number): Promise; -declare function lchown(path: string, uid: number, gid: number, callback: AsyncCallback): void; -/** - * lchownSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function lchownSync - * @param {string} path - path. - * @param {number} uid - uid. - * @param {number} gid - gid. - * @returns {void} lchown success - * @throws {TypedError | Error} lchown fail - */ -declare function lchownSync(path: string, uid: number, gid: number): void; -/** - * lstat. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function lstat - * @param {string} path - path. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function lstat(path: string): Promise; -declare function lstat(path: string, callback: AsyncCallback): void; -/** - * lstatSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function lstatSync - * @param {string} path - path. - * @returns {Stat} lstat success - * @throws {TypedError | Error} lstat fail - */ -declare function lstatSync(path: string): Stat; -/** - * mkdir. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function mkdir - * @param {string} path - path. - * @param {number} [mode = 0o775] - path. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function mkdir(path: string, mode?: number): Promise; -declare function mkdir(path: string, callback: AsyncCallback): void; -declare function mkdir(path: string, mode: number, callback: AsyncCallback): void; -/** - * mkdirSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function mkdirSync - * @param {string} path - path. - * @param {number} [mode = 0o775] - path. - * @returns {void} mkdir success - * @throws {TypedError | Error} mkdir fail - */ -declare function mkdirSync(path: string, mode?: number): void; -/** - * mkdtemp. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function mkdtemp - * @param {string} prefix - dir prefix. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function mkdtemp(prefix: string): Promise; -declare function mkdtemp(prefix: string, callback: AsyncCallback): void; -/** - * mkdtempSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function mkdtempSync - * @param {string} prefix - dir prefix. - * @returns {string} directory name - * @throws {TypedError | Error} mkdtemp fail - */ -declare function mkdtempSync(prefix: string): string; -/** - * open. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function open - * @param {string} path - path. - * @param {number} [flags = 0] - flags. - * @param {number} [mode = 0o666] - mode. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function open(path: string, flags?: number, mode?: number): Promise; -declare function open(path: string, callback: AsyncCallback): void; -declare function open(path: string, flags: number, callback: AsyncCallback): void; -declare function open(path: string, flags: number, mode: number, callback: AsyncCallback): void; -/** - * openSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function openSync - * @param {string} path - path. - * @param {number} [flags = 0] - flags. - * @param {number} [mode = 0o666] - mode. - * @returns {number} open fd - * @throws {TypedError | Error} open fail - */ -declare function openSync(path: string, flags?: number, mode?: number): number; -/** - * opendir. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function opendir - * @param {string} path - directory name. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function opendir(path: string): Promise; -declare function opendir(path: string, callback: AsyncCallback): void; -/** - * opendirSync. - * - * @param {string} path - directory name. - * @returns {Dir} opendir Dir Object - * @throws {TypedError | Error} opendir fail - */ -declare function opendirSync(path: string): Dir; -/** - * readText. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function readText - * @param {string} filePath - file path. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset in bytes. - * @param {number} [options.length = -1] - length in bytes. - * @param {number} [options.encoding = 'utf-8'] - encoding. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function readText(filePath: string, options?: { - position?: number; - length?: number; - encoding?: string; -}): Promise; -declare function readText(filePath: string, options: { - position?: number; - length?: number; - encoding?: string; -}, callback: AsyncCallback): void; - -/** - * readTextSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function readTextSync - * @param {string} filePath - file path. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset in bytes. - * @param {number} [options.length = -1] - length in bytes. - * @param {number} [options.encoding = 'utf-8'] - encoding. - * @returns {string} readout result - * @throws {TypedError} Parameter check failed - */ -declare function readTextSync(filePath: string, options?: { - position?: number; - length?: number; - encoding?: string; -}): string; - -/** - * read. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function read - * @param {number} fd - file descriptor. - * @param {ArrayBuffer} buffer - file descriptor. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset. - * @param {number} [options.length = -1] - length. - * @param {number} [options.position = -1] - position. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function read(fd: number, buffer: ArrayBuffer, options?: { - offset?: number; - length?: number; - position?: number; -}): Promise -declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; -declare function read(fd: number, buffer: ArrayBuffer, options: { - offset?: number; - length?: number; - position?: number; -}, callback: AsyncCallback): void; -/** - * readSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function readSync - * @param {number} fd - file descriptor. - * @param {ArrayBuffer} buffer - file descriptor. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset. - * @param {number} [options.length = -1] - length. - * @param {number} [options.position = -1] - position. - * @returns {number} number of bytesRead - * @throws {TypedError | Error} read fail - */ -declare function readSync(fd: number, buffer: ArrayBuffer, options?: { - offset?: number; - length?: number; - position?: number; -}): number; -/** - * rename. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function rename - * @param {string} oldPath - oldPath. - * @param {string} newPath - newPath. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function rename(oldPath: string, newPath: string): Promise; -declare function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; -/** - * renameSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function renameSync - * @param {string} oldPath - oldPath. - * @param {string} newPath - newPath. - * @returns {void} rename success - * @throws {TypedError | Error} rename fail - */ -declare function renameSync(oldPath: string, newPath: string): void; -/** - * rmdir. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function rmdir - * @param {string} path - path. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function rmdir(path: string): Promise; -declare function rmdir(path: string, callback: AsyncCallback): void; -/** - * rmdirSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function rmdirSync - * @param {string} path - path. - * @returns {void} rmdir success - * @throws {TypedError | Error} rmdir fail - */ -declare function rmdirSync(path: string): void; -/** - * stat. - * @static - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @param {string} path - path. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function stat(path: string): Promise; -declare function stat(path: string, callback: AsyncCallback): void; -/** - * statSync. - * @static - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @param {string} path - path. - * @returns {Stat} stat success - * @throws {TypedError | Error} stat fail - */ -declare function statSync(path: string): Stat; -/** - * symlink. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function symlink - * @param {string} target - target. - * @param {string} srcPath - srcPath. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function symlink(target: string, srcPath: string): Promise; -declare function symlink(target: string, srcPath: string, callback: AsyncCallback): void; -/** - * symlinkSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function symlinkSync - * @param {string} target - target. - * @param {string} srcPath - srcPath. - * @returns {void} symlink success - * @throws {TypedError | Error} symlink fail - */ - declare function symlinkSync(target: string, srcPath: string): void; - /** - * truncate. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function truncate - * @param {string} path - path. - * @param {number} [len = 0] - len. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function truncate(path: string, len?: number): Promise; -declare function truncate(path: string, callback: AsyncCallback): void; -declare function truncate(path: string, len: number, callback: AsyncCallback): void; -/** - * truncateSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function truncateSync - * @param {string} path - path. - * @param {number} [len = 0] - len. - * @returns {void} truncate success - * @throws {TypedError | Error} truncate fail - */ -declare function truncateSync(path: string, len?: number): void; -/** - * unlink. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function unlink - * @param {string} path - path. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ -declare function unlink(path: string): Promise; -declare function unlink(path: string, callback: AsyncCallback): void; -/** - * unlinkSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function unlinkSync - * @param {string} path - path. - * @returns {void} unlink success - * @throws {TypedError | Error} unlink fail - */ -declare function unlinkSync(path: string): void; -/** - * write. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function write - * @param {number} fd - file descriptor. - * @param {ArrayBuffer | string} buffer - file descriptor. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset(bytes) ignored when buffer is string. - * @param {number} [options.length = -1] - length(bytes) ignored when buffer is string. - * @param {number} [options.position = -1] - position(bytes) where start to write < 0 use read, else use pread. - * @param {string} [options.encoding = 'utf-8'] - encoding. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError | RangeError} Parameter check failed - */ -declare function write(fd: number, buffer: ArrayBuffer | string, options?: { - offset?: number; - length?: number; - position?: number; - encoding?: string; -}): Promise; -declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; -declare function write(fd: number, buffer: ArrayBuffer | string, options: { - offset?: number; - length?: number; - position?: number; - encoding?: string; -}, callback: AsyncCallback): void; -/** - * writeSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function writeSync - * @param {number} fd - file descriptor. - * @param {ArrayBuffer | string} buffer - file descriptor. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset(bytes) ignored when buffer is string. - * @param {number} [options.length = -1] - length(bytes) ignored when buffer is string. - * @param {number} [options.position = -1] - position(bytes) where start to write < 0 use read, else use pread. - * @param {string} [options.encoding = 'utf-8'] - encoding. - * @returns {number} on success number of bytesRead - * @throws {TypedError | RangeError | Error} write fail - */ -declare function writeSync(fd: number, buffer: ArrayBuffer | string, options?: { - offset?: number; - length?: number; - position?: number; - encoding?: string; -}): number; - -/** - * createWatcher. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function createWatcher - * @param {string} filename - filename. - * @param {number} events - events(depends on OS & filesystem) events = 1 rename events =2 change. - * @param {AsyncCallback} [callback] - callback. - * @returns {Watcher} watch success - * @throws {TypedError | Error} watch fail - */ -declare function createWatcher(filename: string, events: number, callback: AsyncCallback): Watcher; -/** - * Dir - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - */ -declare interface Dir { - /** - * read. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function read - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed if read to end, Error.msg = "NoMore" - */ - read(): Promise; - read(callback: AsyncCallback): void; - /** - * readSync. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function readSync - * @returns {Dirent} Dirent Object - * @throws {TypedError | Error} read fail if read to end, Error.msg = "NoMore" - */ - readSync(): Dirent; - /** - * close. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @function close - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} close success - * @throws {TypedError | Error} close fail - */ - close(): Promise; - close(callback: AsyncCallback): void; - /** - * closeSync. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @function closeSync - * @returns {void} close success - * @throws {TypedError | Error} close fail - */ - closeSync(): void; -} - -/** - * Dirent - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - */ -declare interface Dirent { - /** - * @type {string} - * @readonly - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - */ - readonly name: string; - /** - * isBlockDevice. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isBlockDevice(): boolean; - /** - * isCharacterDevice. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isCharacterDevice(): boolean; - /** - * isDirectory. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isDirectory(): boolean; - /** - * isFIFO. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isFIFO(): boolean; - /** - * isFile. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isFile(): boolean; - /** - * isSocket. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isSocket(): boolean; - /** - * isSymbolicLink. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isSymbolicLink(): boolean; -} - -/** - * Stat - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - */ -declare interface Stat { - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly dev: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly ino: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly mode: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly nlink: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly uid: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly gid: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly rdev: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly size: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly blocks: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly atime: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly mtime: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - readonly ctime: number; - /** - * isBlockDevice. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isBlockDevice(): boolean; - /** - * isCharacterDevice. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isCharacterDevice(): boolean; - /** - * isDirectory. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isDirectory(): boolean; - /** - * isFIFO. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isFIFO(): boolean; - /** - * isFile. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isFile(): boolean; - /** - * isSocket. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isSocket(): boolean; - /** - * isSymbolicLink. - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {boolean} is or not - */ - isSymbolicLink(): boolean; -} - -/** - * Stream - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - */ -declare interface Stream { - /** - * close. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} close success - * @throws {TypedError | Error} close fail - */ - close(): Promise; - close(callback: AsyncCallback): void; - /** - * closeSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @returns {void} close success - * @throws {TypedError | Error} close fail - */ - closeSync(): void; - /** - * flush. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ - flush(): Promise; - flush(callback: AsyncCallback): void; - /** - * flushSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @returns {void} flush success - * @throws {Error} flush fail - */ - flushSync(): void; - /** - * write. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @param {ArrayBuffer | string} buffer - file description. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset(bytes) ignored when buffer is string. - * @param {number} [options.length = -1] - length(bytes) ignored when buffer is string. - * @param {number} [options.position = -1] - position(bytes) where start to write < 0 use read, else use pread. - * @param {string} [options.encoding = 'utf-8'] - encoding. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ - write(buffer: ArrayBuffer | string, options?: { - offset?: number; - length?: number; - position?: number; - encoding?: string; - }): Promise; - write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; - write(buffer: ArrayBuffer | string, options: { - offset?: number; - length?: number; - position?: number; - encoding?: string; - }, callback: AsyncCallback): void; - /** - * writeSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @param {ArrayBuffer | string} buffer - file description. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset(bytes) ignored when buffer is string. - * @param {number} [options.length = -1] - length(bytes) ignored when buffer is string. - * @param {number} [options.position = -1] - position(bytes) where start to write < 0 use read, else use pread. - * @param {string} [options.encoding = 'utf-8'] - encoding. - * @returns {number} on success number of bytes written - * @throws {TypedError | Error} write fail - */ - writeSync(buffer: ArrayBuffer | string, options?: { - offset?: number; - length?: number; - position?: number; - encoding?: string; - }): number; - /** - * read. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @param {ArrayBuffer} buffer - file description. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset. - * @param {number} [options.length = -1] - length. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - */ - read(buffer: ArrayBuffer, options?: { - position?: number; - offset?: number; - length?: number; - }): Promise; - read(buffer: ArrayBuffer, callback: AsyncCallback): void; - read(buffer: ArrayBuffer, options: { - position?: number; - offset?: number; - length?: number; - }, callback: AsyncCallback): void; - /** - * readSync. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @param {ArrayBuffer} buffer - file description. - * @param {Object} [options] - options. - * @param {number} [options.offset = 0] - offset. - * @param {number} [options.length = -1] - length. - * @returns {number} number of bytesRead - * @throws {TypedError | Error} read fail - */ - readSync(buffer: ArrayBuffer, options?: { - position?: number; - offset?: number; - length?: number; - }): number; -} - -/** - * ReadOut - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - */ -declare interface ReadOut { - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - bytesRead: number; - /** - * @type {number} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - offset: number; - /** - * @type {ArrayBuffer} - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 6 - * @permission N/A - * @readonly - */ - buffer: ArrayBuffer; -} - -/** - * Watcher - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - */ -declare interface Watcher { - /** - * stop. - * - * @note N/A - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 7 - * @permission N/A - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} stop success - * @throws {TypedError | Error} stop fail - */ - stop(): Promise; - stop(callback: AsyncCallback): void; -} \ No newline at end of file diff --git a/interfaces/kits/js/napi/@ohos.securityLabel.d.ts b/interfaces/kits/js/napi/@ohos.securityLabel.d.ts deleted file mode 100644 index 8e3b8629f1ec97cf9089ef6eeb12f4d134b48739..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/napi/@ohos.securityLabel.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback, Callback} from "./basic"; - -/** - * Provides securityLabel APIs - * - * @since 9 - * @syscap SystemCapability.FileManagement.File.FileIO - */ - -declare namespace securityLabel { - - type dataLevel = 's0'|'s1'|'s2'|'s3'|'s4'; - /** - * set the SecurityLabel. - * - * @since 9 - */ - function setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback): void; - function setSecurityLabel(path:string, type:dataLevel): Promise; - - /** - * set the SecurityLabelSync. - * - * @since 9 - */ - function setSecurityLabelSync(path:string, type:dataLevel): void; - - /** - * get the SecurityLabel. - * - * @since 9 - */ - function getSecurityLabel(path:string, callback: AsyncCallback): void; - function getSecurityLabel(path:string): Promise; - - /** - * get the SecurityLabelSync. - * - * @since 9 - */ - function getSecurityLabelSync(path:string): string; -} - -export default securityLabel; \ No newline at end of file diff --git a/interfaces/kits/js/napi/@ohos.statfs.d.ts b/interfaces/kits/js/napi/@ohos.statfs.d.ts deleted file mode 100644 index 4a83f02b8e37d08348623e359707ad84a93daa99..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/napi/@ohos.statfs.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback, Callback} from "./basic"; - -/** - * Provides filesystem statistics APIs - * - * @since 8 - * @syscap SystemCapability.FileManagement.File.FileIO - */ -declare namespace Statfs { - /** - * Get the number of free bytes on the specified path. - * - * @since 8 - */ - function getFreeBytes(path: string, callback: AsyncCallback): void; - function getFreeBytes(path: string): Promise; - /** - * Get the total number of bytes of the specified path. - * - * @since 8 - */ - function getTotalBytes(path: string, callback: AsyncCallback): void; - function getTotalBytes(path: string): Promise; -} - -export default Statfs; diff --git a/interfaces/kits/js/napi/@system.file.d.ts b/interfaces/kits/js/napi/@system.file.d.ts deleted file mode 100644 index 9bd26a69d357ab1ce62b1b475c878890c04ca67b..0000000000000000000000000000000000000000 --- a/interfaces/kits/js/napi/@system.file.d.ts +++ /dev/null @@ -1,752 +0,0 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface FileResponse { - /** - * File URI. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * File size, in bytes. - * If type is dir, the length value is fixed to 0. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - length: number; - - /** - * Timestamp when the file is stored, which is the number of milliseconds elapsed since 1970/01/01 00:00:00. - * For lite wearables, the value is fixed to 0, because this parameter is restricted by the underlying file system. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - lastModifiedTime: number; - - /** - * File type. The values are as follows: - * dir: directory - * file: file - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - type: "dir" | "file"; - - /** - * File list. When the recursive value is true and the type is dir, the file information under the subdirectory will be returned. - * Otherwise, no value will be returned. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - subFiles?: Array; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileMoveOption { - /** - * URI of the file to move. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - srcUri: string; - - /** - * URI of the file moved to the target location. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - dstUri: string; - - /** - * Called when the source file is moved to the specified location successfully. - * This function returns the URI of the file moved to the target location. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: (uri: string) => void; - - /** - * Called when moving fails. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileListResponse { - /** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fileList: Array; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileListOption { - /** - * URI of the directory. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Called when the list is obtained successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: (data: FileListResponse) => void; - - /** - * Called when the list fails to be obtained. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -export interface FileCopyOption { - /** - * URI of the file to copy. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - srcUri: string; - - /** - * URI of the file moved to the target location. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - dstUri: string; - - /** - * Called when the copy file is saved successful. - * This function returns the URI of the file saved to the target location. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: (uri: string) => void; - - /** - * Called when the copy or save operation fails. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -export interface FileGetOption { - /** - * File URI, which cannot be an application resource path. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Whether to recursively obtain the file list under a subdirectory. - * The default value is false. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - recursive?: boolean; - - /** - * Called when file information is obtained successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: (file: FileResponse) => void; - - /** - * Called when file information fails to be obtained. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -export interface FileDeleteOption { - /** - * URI of the file to be deleted, which cannot be an application resource path. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Called when local files are deleted successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: () => void; - - /** - * Called when the deletion fails. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileWriteTextOption { - /** - * URI of a local file. If it does not exist, a file will be created. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Character string to write into the local file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - text: string; - - /** - * Encoding format. The default format is UTF-8. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - encoding?: string; - - /** - * Whether to enable the append mode. The default value is false. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - append?: boolean; - - /** - * Called when texts are written into a file successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: () => void; - - /** - * Called when texts fail to be written into a file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileReadTextResponse { - /** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - text: string; -} - -export interface FileReadTextOption { - /** - * URI of a local file. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Encoding format. The default format is UTF-8. - * Currently, only UTF-8 is supported. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - encoding?: string; - - /** - * Position where the reading starts. - * The default value is the start position of the file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - position?: number; - - /** - * Position where the reading starts. - * The default value is the start position of the file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - length?: number; - - /** - * Called when texts are read successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: (data: FileReadTextResponse) => void; - - /** - * Called when texts fail to be read. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileWriteArrayBufferOption { - /** - * URI of a local file. If it does not exist, a file will be created. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Buffer from which the data is derived. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - buffer: Uint8Array; - - /** - * Offset to the position where the writing starts. The default value is 0. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - position?: number; - - /** - * Whether to enable the append mode. - * The default value is false. If the value is true, the position parameter will become invalid. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - append?: boolean; - - /** - * Called when data from a buffer is written into a file successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: () => void; - - /** - * Called when data from a buffer fails to be written into a file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileReadArrayBufferResponse { - /** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - buffer: Uint8Array; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileReadArrayBufferOption { - /** - * URI of a local file. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Position where the reading starts. - * The default value is the start position of the file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - position?: number; - - /** - * Length of the content to read. - * If this parameter is not set, all content of the file will be read. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - length?: number; - - /** - * Called when the buffer data is read successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: (data: FileReadArrayBufferResponse) => void; - - /** - * Called when the buffer data fails to be read. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileAccessOption { - /** - * URI of the directory or file. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Called when the check result is obtained successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: () => void; - - /** - * Called when the check fails. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileMkdirOption { - /** - * URI of the directory. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * 3. A maximum of five recursions are allowed for creating the directory. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Whether to create the directory after creating its upper-level directory recursively. - * The default value is false. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - recursive?: boolean; - - /** - * Called when the directory is created successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: () => void; - - /** - * Called when the creation fails. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export interface FileRmdirOption { - /** - * URI of the directory. - * Restricted by the underlying file system of lite wearables, the value must meet the following requirements: - * 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F. - * 2. The maximum number of characters allowed is 128. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - uri: string; - - /** - * Whether to delete files and subdirectories recursively. - * The default value is false. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - recursive?: boolean; - - /** - * Called when the directory is deleted successfully. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - success?: () => void; - - /** - * Called when the deletion fails. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - */ -export default class File { - /** - * Moves the source file to a specified location. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static move(options: FileMoveOption): void; - - /** - * Copies a source file and save the copy to a specified location. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static copy(options: FileCopyOption): void; - - /** - * Obtains the list of files in a specified directory. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static list(options: FileListOption): void; - - /** - * Obtains information about a local file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static get(options: FileGetOption): void; - - /** - * Deletes local files. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static delete(options: FileDeleteOption): void; - - /** - * Writes texts into a file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static writeText(options: FileWriteTextOption): void; - - /** - * Reads texts from a file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static readText(options: FileReadTextOption): void; - - /** - * Writes data from a buffer into a file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static writeArrayBuffer(options: FileWriteArrayBufferOption): void; - - /** - * Reads buffer data from a file. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static readArrayBuffer(options: FileReadArrayBufferOption): void; - - /** - * Checks whether a file or directory exists. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static access(options: FileAccessOption): void; - - /** - * Creates a directory. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static mkdir(options: FileMkdirOption): void; - - /** - * Deletes a directory. - * @syscap SystemCapability.FileManagement.File.FileIO - * @since 3 - * @param options Options. - */ - static rmdir(options: FileRmdirOption): void; -} diff --git a/interfaces/kits/js/src/mod_environment/environment_n_exporter.cpp b/interfaces/kits/js/src/mod_environment/environment_n_exporter.cpp index d98d0d281e79ae5274d57af03ad6fed2a8dda467..2c60991511c3e292ae3d8e694e5df9c2afc94770 100644 --- a/interfaces/kits/js/src/mod_environment/environment_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_environment/environment_n_exporter.cpp @@ -57,14 +57,14 @@ napi_value GetStorageDataDir(napi_env env, napi_callback_info info) return NVal::CreateUTF8String(env, STORAGE_DATA_PATH); }; - static const std::string procedureName = "GetStorageDataDir"; + static const std::string PROCEDURE_NAME = "GetStorageDataDir"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ZERO) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::FIRST]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } int GetUserId() @@ -97,14 +97,14 @@ napi_value GetUserDataDir(napi_env env, napi_callback_info info) return NVal::CreateUTF8String(env, *userDataPath); }; - static const std::string procedureName = "GetUserDataDir"; + static const std::string PROCEDURE_NAME = "GetUserDataDir"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ZERO) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::FIRST]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } } // namespace ModuleEnvironment } // namespace FileManagement diff --git a/interfaces/kits/js/src/mod_fileio/class_dir/dir_n_exporter.cpp b/interfaces/kits/js/src/mod_fileio/class_dir/dir_n_exporter.cpp index 7f04651a3295880471e96087c6c6a2a1c16d7d14..ed53fb3ea98a95b03ae4d104a43161078487f83e 100644 --- a/interfaces/kits/js/src/mod_fileio/class_dir/dir_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fileio/class_dir/dir_n_exporter.cpp @@ -103,12 +103,12 @@ napi_value DirNExporter::Close(napi_env env, napi_callback_info info) }; NVal thisVar(env, funcArg.GetThisVar()); - static const string procedureName = "fileioDirClose"; + static const string PROCEDURE_NAME = "fileioDirClose"; if (funcArg.GetArgc() == NARG_CNT::ZERO) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbCompl).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbCompl).val_; } else { NVal cb(env, funcArg[NARG_POS::FIRST]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbCompl).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbCompl).val_; } } @@ -196,12 +196,12 @@ napi_value DirNExporter::Read(napi_env env, napi_callback_info info) return DoReadComplete(env, err, arg); }; NVal thisVar(env, funcArg.GetThisVar()); - const string procedureName = "fileioDirRead"; + const string PROCEDURE_NAME = "fileioDirRead"; if (funcArg.GetArgc() == NARG_CNT::ZERO) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbCompl).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbCompl).val_; } else { NVal cb(env, funcArg[NARG_POS::FIRST]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbCompl).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbCompl).val_; } } diff --git a/interfaces/kits/js/src/mod_securitylabel/securitylabel_n_exporter.cpp b/interfaces/kits/js/src/mod_securitylabel/securitylabel_n_exporter.cpp index da979a107c285269f044eb4d4d411ec018b167d0..b8d305ff0c8274e381e5206e81d7474d0627598a 100644 --- a/interfaces/kits/js/src/mod_securitylabel/securitylabel_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_securitylabel/securitylabel_n_exporter.cpp @@ -70,13 +70,13 @@ napi_value SetSecurityLabel(napi_env env, napi_callback_info info) } return NVal::CreateUndefined(env); }; - static const std::string procedureName = "SetSecurityLabel"; + static const std::string PROCEDURE_NAME = "SetSecurityLabel"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == static_cast(NARG_CNT::TWO)) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } else { NVal cb(env, funcArg[static_cast(NARG_POS::THIRD)]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } } @@ -151,14 +151,14 @@ napi_value GetSecurityLabel(napi_env env, napi_callback_info info) return { NVal::CreateUTF8String(env, *result) }; }; - static const std::string procedureName = "GetSecurityLabel"; + static const std::string PROCEDURE_NAME = "GetSecurityLabel"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == static_cast(NARG_CNT::ONE)) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } else { NVal cb(env, funcArg[static_cast(NARG_POS::SECOND)]); if (cb.TypeIs(napi_function)) { - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } } return NVal::CreateUndefined(env).val_; diff --git a/interfaces/kits/js/src/mod_statfs/statfs_n_exporter.cpp b/interfaces/kits/js/src/mod_statfs/statfs_n_exporter.cpp index a36854b6977d27250c00b5025eb30c7e4461b60d..21696e84e3ec594ffacdf4f9bb8d804f3d00fad3 100644 --- a/interfaces/kits/js/src/mod_statfs/statfs_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_statfs/statfs_n_exporter.cpp @@ -85,14 +85,14 @@ napi_value GetFrSize(napi_env env, napi_callback_info info) return NVal::CreateInt64(env, *resultSize); }; - static const std::string procedureName = "GetFrSize"; + static const std::string PROCEDURE_NAME = "GetFrSize"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } napi_value GetBSizeSync(napi_env env, napi_callback_info info) @@ -154,14 +154,14 @@ napi_value GetBSize(napi_env env, napi_callback_info info) return NVal::CreateInt64(env, *resultSize); }; - static const std::string procedureName = "GetBSize"; + static const std::string PROCEDURE_NAME = "GetBSize"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } napi_value GetBAvailSync(napi_env env, napi_callback_info info) @@ -223,14 +223,14 @@ napi_value GetBAvail(napi_env env, napi_callback_info info) return NVal::CreateInt64(env, *resultSize); }; - static const std::string procedureName = "GetBAvail"; + static const std::string PROCEDURE_NAME = "GetBAvail"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } napi_value GetBlocksSync(napi_env env, napi_callback_info info) @@ -292,14 +292,14 @@ napi_value GetBlocks(napi_env env, napi_callback_info info) return NVal::CreateInt64(env, *resultSize); }; - static const std::string procedureName = "GetBlocks"; + static const std::string PROCEDURE_NAME = "GetBlocks"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } napi_value GetBFreeSync(napi_env env, napi_callback_info info) @@ -361,14 +361,14 @@ napi_value GetBFree(napi_env env, napi_callback_info info) return NVal::CreateInt64(env, *resultSize); }; - static const std::string procedureName = "GetBFree"; + static const std::string PROCEDURE_NAME = "GetBFree"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } napi_value GetFreeBytesSync(napi_env env, napi_callback_info info) @@ -433,14 +433,14 @@ napi_value GetFreeBytes(napi_env env, napi_callback_info info) return NVal::CreateInt64(env, *resultSize); }; - static const std::string procedureName = "GetFreeBytes"; + static const std::string PROCEDURE_NAME = "GetFreeBytes"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } napi_value GetTotalBytesSync(napi_env env, napi_callback_info info) @@ -505,14 +505,14 @@ napi_value GetTotalBytes(napi_env env, napi_callback_info info) return { NVal::CreateInt64(env, *resultSize) }; }; - static const std::string procedureName = "GetTotalBytes"; + static const std::string PROCEDURE_NAME = "GetTotalBytes"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } } // namespace ModuleStatfs } // namespace FileManagement diff --git a/interfaces/kits/js/src/mod_statvfs/statvfs_n_exporter.cpp b/interfaces/kits/js/src/mod_statvfs/statvfs_n_exporter.cpp index ce9b223095f29422adc37f1371d0f665941bcd8c..b39e600df5261fda2bbfffdef22a8ab3f6810e63 100644 --- a/interfaces/kits/js/src/mod_statvfs/statvfs_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_statvfs/statvfs_n_exporter.cpp @@ -89,14 +89,14 @@ napi_value GetFreeSize(napi_env env, napi_callback_info info) return NVal::CreateInt64(env, *resultSize); }; - static const std::string procedureName = "GetFreeSize"; + static const std::string PROCEDURE_NAME = "GetFreeSize"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } napi_value GetTotalSizeSync(napi_env env, napi_callback_info info) @@ -165,14 +165,14 @@ napi_value GetTotalSize(napi_env env, napi_callback_info info) return { NVal::CreateInt64(env, *resultSize) }; }; - static const std::string procedureName = "GetTotalSize"; + static const std::string PROCEDURE_NAME = "GetTotalSize"; NVal thisVar(env, funcArg.GetThisVar()); if (funcArg.GetArgc() == NARG_CNT::ONE) { - return NAsyncWorkPromise(env, thisVar).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkPromise(env, thisVar).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } NVal cb(env, funcArg[NARG_POS::SECOND]); - return NAsyncWorkCallback(env, thisVar, cb).Schedule(procedureName, cbExec, cbComplete).val_; + return NAsyncWorkCallback(env, thisVar, cb).Schedule(PROCEDURE_NAME, cbExec, cbComplete).val_; } } // namespace ModuleStatfs } // namespace FileManagement