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.
@@ -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
- if (url is URL) || (url is String)
114
- {
115
- if (url is URL) {
116
- fileURL = url as? URL
117
- }
118
- else {
119
- fileURL = URL(fileURLWithPath: url as! String)
120
- }
121
- var fileSizeValue = 0.0
122
- try? fileSizeValue = (fileURL?.resourceValues(forKeys: [URLResourceKey.fileSizeKey]).allValues.first?.value as! Double?)!
123
- if fileSizeValue > 0.0 {
124
- fileSize = Double(fileSizeValue)
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
- // MARK: - types
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 maximum width boundary used when compressing a landscape image.
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.2",
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",
@@ -14,7 +14,7 @@ export type compressionMethod = 'auto' | 'manual';
14
14
 
15
15
  export type CompressorOptions = {
16
16
  /***
17
- * The maximum width boundary used when compressing a landscape image.
17
+ * The compression method to use.
18
18
  */
19
19
  compressionMethod?: compressionMethod;
20
20
  /***