How to use the expo-file-system.moveAsync 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 passes when used properly', () => {
    moveAsync({ from: '', to: '' }).then(fileInfo => {
      (fileInfo: void);

      // $ExpectError: check any
      (fileInfo: number);
    });
  });
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
    moveAsync();
    // $ExpectError: first argument must be an object
    moveAsync(69);
    // $ExpectError: need 'to' prop
    moveAsync({ from: '' });
    // $ExpectError: need 'from' prop
    moveAsync({ to: '' });
    moveAsync({
      // $ExpectError: need string
      from: 69,
      // $ExpectError: need string
      to: 69,
    });
  });
});
github wcandillon / react-native-expo-image-cache / src / CacheManager.ts View on Github external
async getPath(): Promise {
        const { uri, options } = this;
        const { path, exists, tmpPath } = await getCacheEntry(uri);
        if (exists) {
            return path;
        }
        const result = await FileSystem.createDownloadResumable(uri, tmpPath, options).downloadAsync();
        // If the image download failed, we don't cache anything
        if (result && result.status !== 200) {
            return undefined;
        }
        await FileSystem.moveAsync({ from: tmpPath, to: path });
        return path;
    }
}
github czy0729 / Bangumi / components / @ / react-native-expo-image-cache / src / CacheManager.js View on Github external
async getPath() {
    const { uri, options } = this
    const { path, exists, tmpPath } = await getCacheEntry(uri)
    if (exists) {
      return path
    }
    const result = await FileSystem.createDownloadResumable(
      uri,
      tmpPath,
      options
    ).downloadAsync()
    // If the image download failed, we don't cache anything
    if (result && result.status !== 200) {
      return undefined
    }
    await FileSystem.moveAsync({ from: tmpPath, to: path })
    return path
  }
}