How to use react-native-file-type - 1 common examples

To help you get started, we’ve selected a few react-native-file-type 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 XavierColombel / react-native-cloudinary-unsigned / index.js View on Github external
return new Promise((resolve, reject) => {
      if (CLOUD_NAME && UPLOAD_PROFILE_NAME) {
        if (file) {
          fileType(file).then(type => {
            const url = `${API_END_POINT}${CLOUD_NAME}/image/upload`;
            const fd = new FormData();
            const name = filename
              ? `${filename}.${type.ext}`
              : `upload.${type.ext}`;
            fd.append("upload_preset", UPLOAD_PROFILE_NAME);
            fd.append("file", {
              name,
              uri: file,
              type: type.mime
            });
            const config = {
              headers: {
                "Content-Type": "multipart/form-data"
              }
            };

react-native-file-type

React Native Support for sindresorhus/file-type

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular react-native-file-type functions