How to use the expo-file-system.writeAsStringAsync 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', () => {
    writeAsStringAsync('fileUri', 'content').then(fileInfo => {
      (fileInfo: void);

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

    writeAsStringAsync('fileUri', 'content', { encoding: 'base64' });
    writeAsStringAsync('fileUri', 'content', {
      encoding: 'utf8',
    });
  });
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
    writeAsStringAsync();
    // $ExpectError: first argument must be a string
    writeAsStringAsync(69);
    // $ExpectError: second argument must be a string
    writeAsStringAsync('', 69);
    // $ExpectError: third argument must be an object
    writeAsStringAsync('', '', 69);
    // $ExpectError: 'abc' is missing in options
    writeAsStringAsync('', '', { abc: 'test' });
    writeAsStringAsync('', '', {
      // $ExpectError: invalid value
      encoding: 'кукусики',
    });
  });
});
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
    writeAsStringAsync();
    // $ExpectError: first argument must be a string
    writeAsStringAsync(69);
    // $ExpectError: second argument must be a string
    writeAsStringAsync('', 69);
    // $ExpectError: third argument must be an object
    writeAsStringAsync('', '', 69);
    // $ExpectError: 'abc' is missing in options
    writeAsStringAsync('', '', { abc: 'test' });
    writeAsStringAsync('', '', {
      // $ExpectError: invalid value
      encoding: 'кукусики',
    });
  });
});
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
    writeAsStringAsync();
    // $ExpectError: first argument must be a string
    writeAsStringAsync(69);
    // $ExpectError: second argument must be a string
    writeAsStringAsync('', 69);
    // $ExpectError: third argument must be an object
    writeAsStringAsync('', '', 69);
    // $ExpectError: 'abc' is missing in options
    writeAsStringAsync('', '', { abc: 'test' });
    writeAsStringAsync('', '', {
      // $ExpectError: invalid value
      encoding: 'кукусики',
    });
  });
});
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', () => {
    writeAsStringAsync('fileUri', 'content').then(fileInfo => {
      (fileInfo: void);

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

    writeAsStringAsync('fileUri', 'content', { encoding: 'base64' });
    writeAsStringAsync('fileUri', 'content', {
      encoding: 'utf8',
    });
  });
github bugsnag / bugsnag-js / packages / delivery-expo / queue.js View on Github external
async enqueue (req) {
    try {
      await this.init()
      await FileSystem.writeAsStringAsync(
        `${this._path}/${generateFilename(this._resource)}`,
        JSON.stringify({ ...req, retries: 0 })
      )
      this._truncate()
    } catch (e) {
      this._onerror(e)
    }
  }
github Nohac / redux-persist-expo-fs-storage / lib / index.js View on Github external
const setItem = (key, value, callback) => withCallback(callback, async () => {
    const { exists } = await FileSystem.getInfoAsync(baseFolder);
    if (exists == false) {
      await FileSystem.makeDirectoryAsync(baseFolder, {
        intermediates: true
      });
    }
    await FileSystem.writeAsStringAsync(pathForKey(key), value);
  });
github expo / expo / packages / expo / build / DataMigrationHelper.js View on Github external
async function addLockToOldFilesDirectory(path) {
    await FileSystem.writeAsStringAsync(path + LOCK_FILE_NAME, 'lock');
}
export async function migrateFilesFromLegacyDirectoryAsync(resolveConflict) {
github Nohac / redux-persist-expo-fs-storage / index.js View on Github external
withCallback(callback, async () => {
      const { exists } = await FileSystem.getInfoAsync(baseFolder);
      if (exists == false) {
        await FileSystem.makeDirectoryAsync(baseFolder, {
          intermediates: true,
        });
      }
      await FileSystem.writeAsStringAsync(pathForKey(key), value);
    });