react-native-compressor 1.10.2 → 1.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ios/Utils/Utils.swift
CHANGED
|
@@ -110,20 +110,24 @@ class Utils {
|
|
|
110
110
|
static func getfileSizeInBytes(forURL url: Any) -> Double {
|
|
111
111
|
var fileURL: URL?
|
|
112
112
|
var fileSize: Double = 0.0
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
|
|
114
|
+
if (url is URL) {
|
|
115
|
+
let urlWithSlash = Utils.slashifyFilePath(path: (url as? URL)?.absoluteString)
|
|
116
|
+
fileURL = URL(string: urlWithSlash!)
|
|
117
|
+
} else if (url is String) {
|
|
118
|
+
let urlWithSlash = Utils.slashifyFilePath(path: url as? String)
|
|
119
|
+
fileURL = URL(fileURLWithPath: urlWithSlash!)
|
|
120
|
+
} else {
|
|
121
|
+
return fileSize
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var fileSizeValue = 0.0
|
|
125
|
+
|
|
126
|
+
try? fileSizeValue = (fileURL?.resourceValues(forKeys: [URLResourceKey.fileSizeKey]).allValues.first?.value as! Double?)!
|
|
127
|
+
if fileSizeValue > 0.0 {
|
|
128
|
+
fileSize = Double(fileSizeValue)
|
|
126
129
|
}
|
|
130
|
+
|
|
127
131
|
return fileSize
|
|
128
132
|
}
|
|
129
133
|
|
|
@@ -4,7 +4,8 @@ import Foundation
|
|
|
4
4
|
import AVFoundation
|
|
5
5
|
import CoreAudioTypes
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// TODO: need to add a support for check if this is not defined in the coreaudio types
|
|
8
|
+
let kAudioFormatAPAC: UInt32 = 1634754915 // 'apac'
|
|
8
9
|
|
|
9
10
|
/// Session export errors.
|
|
10
11
|
public enum NextLevelSessionExporterError: Error, CustomStringConvertible {
|
|
@@ -4,7 +4,7 @@ export type ReturnableOutputType = 'uri' | 'base64';
|
|
|
4
4
|
export type compressionMethod = 'auto' | 'manual';
|
|
5
5
|
export type CompressorOptions = {
|
|
6
6
|
/***
|
|
7
|
-
* The
|
|
7
|
+
* The compression method to use.
|
|
8
8
|
*/
|
|
9
9
|
compressionMethod?: compressionMethod;
|
|
10
10
|
/***
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-compressor",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"description": "Compress Image, Video, and Audio same like Whatsapp & Auto/Manual Compression | Background Upload | Download File | Create Video Thumbnail",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
package/src/Image/index.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export type compressionMethod = 'auto' | 'manual';
|
|
|
14
14
|
|
|
15
15
|
export type CompressorOptions = {
|
|
16
16
|
/***
|
|
17
|
-
* The
|
|
17
|
+
* The compression method to use.
|
|
18
18
|
*/
|
|
19
19
|
compressionMethod?: compressionMethod;
|
|
20
20
|
/***
|