react-native-fs-turbo
Version:
React-Native library for working with Android/iOS file system, written using JSI and C++ TurboModules
51 lines (46 loc) • 1.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getRNFSTurboModule = getRNFSTurboModule;
var _reactNative = require("react-native");
var _ModuleNotFoundError = require("./ModuleNotFoundError");
/* eslint-disable import/no-import-module-exports */
/**
* Used for configuration of a single RNFSTurbo instance.
*/
/**
* Used for configuration of a single RNFSTurbo instance.
*/
let _module;
let configuration;
function getRNFSTurboModule() {
try {
if (_module == null) {
// 1. Load RNFS TurboModule
_module = _reactNative.TurboModuleRegistry.getEnforcing("RNFSTurboModule");
// 2. Create platform-specific configuration
configuration = {
mainBundlePath: _module.getMainBundlePath(),
cachesDirectoryPath: _module.getCachesDirectoryPath(),
documentDirectoryPath: _module.getDocumentDirectoryPath(),
temporaryDirectoryPath: _module.getTemporaryDirectoryPath(),
libraryDirectoryPath: _module.getLibraryDirectoryPath(),
externalDirectoryPath: _module.getExternalDirectoryPath(),
externalStorageDirectoryPath: _module.getExternalStorageDirectoryPath(),
externalCachesDirectoryPath: _module.getExternalCachesDirectoryPath(),
downloadDirectoryPath: _module.getDownloadDirectoryPath(),
picturesDirectoryPath: _module.getPicturesDirectoryPath(),
roamingDirectoryPath: _module.getRoamingDirectoryPath()
};
}
return {
configuration,
module: _module
};
} catch {
// TurboModule could not be found!
throw new _ModuleNotFoundError.ModuleNotFoundError();
}
}
//# sourceMappingURL=NativeRNFSTurboModule.js.map