Skip to content

Commit 9e63f67

Browse files
committed
revert: remove react-native-fs from package and added in example
1 parent f3d3147 commit 9e63f67

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

example/src/Screens/Audio/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import React, { useState } from 'react';
22
import { View, StyleSheet } from 'react-native';
33
import Button from '../../Components/Button';
44
import Row from '../../Components/Row';
5-
import { Audio, getFileInfo } from 'react-native-compressor';
5+
import { Audio } from 'react-native-compressor';
66
import DocumentPicker from 'react-native-document-picker';
77
const prettyBytes = require('pretty-bytes');
8+
import { getFileInfo } from '../../Utils';
89

910
const Index = () => {
1011
const [fileName, setFileName] = useState('');

example/src/Screens/Image/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import Button from '../../Components/Button';
1010
import Row from '../../Components/Row';
1111
import * as ImagePicker from 'react-native-image-picker';
1212
const prettyBytes = require('pretty-bytes');
13-
import { Image, getFileInfo } from 'react-native-compressor';
13+
import { Image } from 'react-native-compressor';
14+
import { getFileInfo } from '../../Utils';
1415
const Index = () => {
1516
const dimension = useWindowDimensions();
1617
const [orignalUri, setOrignalUri] = useState<string>();

example/src/Screens/Video/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import * as React from 'react';
22
import { View, Text, Button, Image, Alert, Platform } from 'react-native';
3-
import { Video, getFileInfo } from 'react-native-compressor';
3+
import { Video } from 'react-native-compressor';
44
import * as ImagePicker from 'react-native-image-picker';
55
import { createThumbnail } from 'react-native-create-thumbnail';
66
import * as Progress from 'react-native-progress';
77
const prettyBytes = require('pretty-bytes');
88
import { v4 as uuidv4 } from 'uuid';
99
const RNFS = require('react-native-fs');
10+
import { getFileInfo } from '../../Utils';
1011

1112
export default function App() {
1213
const [sourceVideo, setSourceVideo] = React.useState<string>();

example/src/Utils/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const RNFS = require('react-native-fs');
12
export const getFullFilename = (path: string | null) => {
23
if (typeof path === 'string') {
34
let _path = path;
@@ -11,3 +12,5 @@ export const getFullFilename = (path: string | null) => {
1112
}
1213
return '';
1314
};
15+
16+
export const getFileInfo = RNFS.stat;

src/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Video, { VideoCompressorType } from './Video';
22
import Audio from './Audio';
33
import Image from './Image';
4-
import { getDetails, getFileInfo } from './utils';
4+
import { getDetails } from './utils';
55

66
export {
77
Video,
@@ -10,12 +10,10 @@ export {
1010
//type
1111
VideoCompressorType,
1212
getDetails,
13-
getFileInfo,
1413
};
1514
export default {
1615
Video,
1716
Audio,
1817
Image,
1918
getDetails,
20-
getFileInfo,
2119
};

src/utils/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { NativeModules } from 'react-native';
22
const { Compressor } = NativeModules;
33
export const AUDIO_BITRATE = [256, 192, 160, 128, 96, 64, 32];
4-
const RNFS = require('react-native-fs');
54
type qualityType = 'low' | 'medium' | 'high';
65
const INCORRECT_INPUT_PATH = 'Incorrect input path. Please provide a valid one';
76
const INCORRECT_OUTPUT_PATH =
@@ -77,7 +76,6 @@ const isRemoteMedia = (path: string | null) => {
7776
return typeof path === 'string' ? path.split(':/')[0].includes('http') : null;
7877
};
7978

80-
export const getFileInfo = RNFS.stat;
8179
export const getDetails = (
8280
mediaFullPath: string,
8381
extesnion: 'mp3' | 'mp4' = 'mp3'

0 commit comments

Comments
 (0)