How to use the expo-file-system.deleteAsync 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
    deleteAsync();
    // $ExpectError: first argument must be a string
    deleteAsync(69);
    // $ExpectError: second argument must be an object
    deleteAsync('', 69);
    // $ExpectError: 'abc' is missing in options
    deleteAsync('', { abc: 'test' });
    deleteAsync('', {
      // $ExpectError
      idempotent: '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
    deleteAsync();
    // $ExpectError: first argument must be a string
    deleteAsync(69);
    // $ExpectError: second argument must be an object
    deleteAsync('', 69);
    // $ExpectError: 'abc' is missing in options
    deleteAsync('', { abc: 'test' });
    deleteAsync('', {
      // $ExpectError
      idempotent: '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
    deleteAsync();
    // $ExpectError: first argument must be a string
    deleteAsync(69);
    // $ExpectError: second argument must be an object
    deleteAsync('', 69);
    // $ExpectError: 'abc' is missing in options
    deleteAsync('', { abc: 'test' });
    deleteAsync('', {
      // $ExpectError
      idempotent: 'need boolean',
    });
  });
});
github RocketChat / Rocket.Chat.ReactNative / app / lib / rocketchat.js View on Github external
try {
			// RC 0.60.0
			await this.sdk.logout();
		} catch (error) {
			console.log('​logout -> api logout -> catch -> error', error);
		}
		this.sdk = null;

		try {
			const servers = await RNUserDefaults.objectForKey(SERVERS);
			await RNUserDefaults.setObjectForKey(SERVERS, servers && servers.filter(srv => srv[SERVER_URL] !== server));
			// clear certificate for server - SSL Pinning
			const certificate = await RNUserDefaults.objectForKey(extractHostname(server));
			if (certificate && certificate.path) {
				await RNUserDefaults.clear(extractHostname(server));
				await FileSystem.deleteAsync(certificate.path);
			}
		} catch (error) {
			console.log('logout_rn_user_defaults', error);
		}

		const userId = await RNUserDefaults.get(`${ TOKEN_KEY }-${ server }`);

		try {
			const serversDB = database.servers;
			await serversDB.action(async() => {
				const usersCollection = serversDB.collections.get('users');
				const userRecord = await usersCollection.find(userId);
				const serverCollection = serversDB.collections.get('servers');
				const serverRecord = await serverCollection.find(server);
				await serversDB.batch(
					userRecord.prepareDestroyPermanently(),
github expo / expo / apps / native-component-list / src / screens / GL / GLHeadlessRenderingScreen.tsx View on Github external
this.isDrawing = true;

    const gl = await glPromise;

    gl.uniform1f(contrastLocation, this.state.contrast);
    gl.drawArrays(gl.TRIANGLES, 0, 6);
    gl.endFrameEXP();

    // we need to use flip option because framebuffer contents are flipped vertically
    const snapshot = await GLView.takeSnapshotAsync(gl, {
      flip: true,
    });

    // delete previous snapshot
    if (this.state.snapshot) {
      FileSystem.deleteAsync(this.state.snapshot.uri as string, { idempotent: true });
    }

    this.setState({ snapshot });
    this.isDrawing = false;
  }
github neverdull-agency / expo-unlimited-secure-store / src / storage.js View on Github external
return new Promise(async (resolve, reject) => {
        try {
            const currentStorageFileUri = await fixedStorageUri(secureStoreOptions);
            if (currentStorageFileUri) {
                let storageString = await FileSystem.readAsStringAsync(currentStorageFileUri);
                storage = JSON.parse(storageString);
                delete storage.key;
                storageString = JSON.stringify(storage);

                const newStorageFileUri = await generateStorageFileUri();
                await FileSystem.writeAsStringAsync(newStorageFileUri, storageString);
                await SecureStore.setItemAsync(storageFileUriKey, newStorageFileUri, secureStoreOptions);
                await FileSystem.deleteAsync(currentStorageFileUri, { idempotent: true });
            } 

            await SecureStore.deleteItemAsync(key, secureStoreOptions);

            resolve();
        } catch (e) {
            reject(e);
        }
    });
};
github czy0729 / Bangumi / components / @ / react-native-expo-image-cache / src / CacheManager.js View on Github external
static async clearCache() {
    await FileSystem.deleteAsync(BASE_DIR, { idempotent: true })
    await FileSystem.makeDirectoryAsync(BASE_DIR)
  }
  static async getCacheSize() {
github wcandillon / react-native-expo-image-cache / src / CacheManager.ts View on Github external
static async clearCache(): Promise {
        await FileSystem.deleteAsync(BASE_DIR, { idempotent: true });
        await FileSystem.makeDirectoryAsync(BASE_DIR);
    }
github expo / expo / packages / expo / build / DataMigrationHelper.js View on Github external
async function treeSearch(relativePath, legacyPath, newPath, resolveConflict) {
    const currentNewPath = `${newPath}${relativePath}`;
    const currentLegacyPath = `${legacyPath}${relativePath}`;
    const legacyPathInfo = await FileSystem.getInfoAsync(currentLegacyPath);
    const newPathInfo = await FileSystem.getInfoAsync(currentNewPath);
    if (legacyPathInfo.exists && !newPathInfo.exists) {
        await FileSystem.copyAsync({
            from: currentLegacyPath,
            to: currentNewPath,
        });
        await FileSystem.deleteAsync(currentLegacyPath);
        return;
    }
    if (legacyPathInfo.isDirectory) {
        const children = await FileSystem.readDirectoryAsync(currentLegacyPath);
        for (let child of children) {
            await treeSearch(relativePath + `${child}/`, legacyPath, newPath, resolveConflict);
        }
    }
    else {
        await resolveConflict(currentLegacyPath, currentNewPath);
    }
}
async function doesOldFilesDirectoryContainLock(path) {