1 /* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef INTERFACES_KITS_JS_SRC_MOD_FS_CLASS_FILE_FILE_N_EXPORTER_H 17 #define INTERFACES_KITS_JS_SRC_MOD_FS_CLASS_FILE_FILE_N_EXPORTER_H 18 19 #include "n_exporter.h" 20 21 namespace OHOS { 22 namespace FileManagement { 23 namespace ModuleFileIO { 24 using namespace OHOS::FileManagement::LibN; 25 class FileNExporter final : public NExporter { 26 public: 27 inline static const std::string className_ = "File"; 28 29 bool Export() override; 30 #ifdef WIN_PLATFORM 31 std::string GetNExporterName() override; 32 #else 33 std::string GetClassName() override; 34 #endif 35 36 #if !defined(WIN_PLATFORM) && !defined(IOS_PLATFORM) 37 static napi_value GetPath(napi_env env, napi_callback_info info); 38 static napi_value GetName(napi_env env, napi_callback_info info); 39 static napi_value GetParent(napi_env env, napi_callback_info info); 40 static napi_value Lock(napi_env env, napi_callback_info info); 41 static napi_value TryLock(napi_env env, napi_callback_info info); 42 static napi_value UnLock(napi_env env, napi_callback_info info); 43 #endif 44 static napi_value Constructor(napi_env env, napi_callback_info info); 45 static napi_value GetFD(napi_env env, napi_callback_info info); 46 47 FileNExporter(napi_env env, napi_value exports); 48 ~FileNExporter() override; 49 }; 50 51 const std::string PROCEDURE_LOCK_NAME = "FileIOFileLock"; 52 } // namespace ModuleFileIO 53 } // namespace FileManagement 54 } // namespace OHOS 55 #endif // INTERFACES_KITS_JS_SRC_MOD_FS_CLASS_FILE_FILE_N_EXPORTER_H