How to use the expo-file-system.makeDirectoryAsync function in expo-file-system

To help you get started, we’ve selected a few expo-file-system examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / expo-file-system_v4.x.x / flow_v0.69.0-v0.103.x / test_expo-file-system.js View on Github external
it('should raises an error when pass invalid arguments', () => {
    // $ExpectError: first argument is required
    makeDirectoryAsync();
    // $ExpectError: first argument must be a string
    makeDirectoryAsync(69);
    // $ExpectError: second argument must be an object
    makeDirectoryAsync('', 69);
    // $ExpectError: 'abc' is missing in options
    makeDirectoryAsync('', { abc: 'test' });
    makeDirectoryAsync('', {
      // $ExpectError
      intermediates: 'need boolean',
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-file-system_v4.x.x / flow_v0.69.0-v0.103.x / test_expo-file-system.js View on Github external
it('should raises an error when pass invalid arguments', () => {
    // $ExpectError: first argument is required
    makeDirectoryAsync();
    // $ExpectError: first argument must be a string
    makeDirectoryAsync(69);
    // $ExpectError: second argument must be an object
    makeDirectoryAsync('', 69);
    // $ExpectError: 'abc' is missing in options
    makeDirectoryAsync('', { abc: 'test' });
    makeDirectoryAsync('', {
      // $ExpectError
      intermediates: 'need boolean',
    });
  });
});
github flow-typed / flow-typed / definitions / npm / expo-file-system_v4.x.x / flow_v0.69.0-v0.103.x / test_expo-file-system.js View on Github external
it('should passes when used properly', () => {
    makeDirectoryAsync('fileUri').then(fileInfo => {
      (fileInfo: void);

      // $ExpectError: check any
      (fileInfo: number);
    });

    makeDirectoryAsync('fileUri', { intermediates: true });
  });
github flow-typed / flow-typed / definitions / npm / expo-file-system_v4.x.x / flow_v0.69.0-v0.103.x / test_expo-file-system.js View on Github external
it('should raises an error when pass invalid arguments', () => {
    // $ExpectError: first argument is required
    makeDirectoryAsync();
    // $ExpectError: first argument must be a string
    makeDirectoryAsync(69);
    // $ExpectError: second argument must be an object
    makeDirectoryAsync('', 69);
    // $ExpectError: 'abc' is missing in options
    makeDirectoryAsync('', { abc: 'test' });
    makeDirectoryAsync('', {
      // $ExpectError
      intermediates: 'need boolean',
    });
  });
});
github bugsnag / bugsnag-js / packages / delivery-expo / queue.js View on Github external
async _init () {
    if (await this._checkCacheDirExists()) return
    try {
      await FileSystem.makeDirectoryAsync(this._path, { intermediates: true })
    } catch (e) {
      // Expo has a bug where `makeDirectoryAsync` can error, even though it succesfully
      // created the directory. See:
      //   https://github.com/expo/expo/issues/2050
      //   https://forums.expo.io/t/makedirectoryasync-error-could-not-be-created/11916
      //
      // To tolerate this, after getting an error, we check whether the directory
      // now exist, swallowing the error if so, rethrowing if not.
      if (await this._checkCacheDirExists()) return
      throw e
    }
  }
github expo / expo / home / utils / ImageSelectionUtils.ts View on Github external
async function ensureDirectory(directory: string): Promise {
  try {
    await FileSystem.makeDirectoryAsync(directory);
  } catch (error) {}
}
github neverdull-agency / expo-unlimited-secure-store / src / storage.js View on Github external
.then(({ exists }) => {
        if (!exists) {
            FileSystem.makeDirectoryAsync(storageDirectoryUri, { intermediates: true });
        }
    });
};
github Nohac / redux-persist-expo-fs-storage / index.js View on Github external
withCallback(callback, async () => {
      await FileSystem.makeDirectoryAsync(baseFolder, {
        intermediates: true,
      });
      const baseFolderLength = baseFolder.length;
      const files = await FileSystem.readDirectoryAsync(baseFolder);
      return files.map(fileUri =>
        decodeURIComponent(fileUri.substring(baseFolderLength)),
      );
    });