Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Unable to copy static assets #415

Open
@natwales

Description

@natwales

react-native-fetch-blob: 0.10.5
RN 0.44
currently testing on iOS.

in App.js I'm including a static image asset.
const imageToCopy = require('./assets/images/test.jpg');

Now I want to take that static asset and copy it to a local file

I've been unable to get fs.asset() to give me an image path I can work with. I'm not sure if there is a bug or I am not coding this properly. I've tried every variation including the following:

const sourcePath = fs.asset('/src/assets/images/test.jpg');
const sourcePath = fs.asset('test.jpg');
const sourcePath =fs.asset('./assets/image/test.jpg');

but in every case when I go to copy the file with fs.cp(sourcePath, newPath) I am getting an error that an asset does not exist at the supplied paths (I can confirm newPath is fine since it is working with non static assets)

A quick example of usage on ios (and android) would be much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions