@capgo/capacitor-file-compressor 8.1.2 → 8.1.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.
|
@@ -20,7 +20,7 @@ import java.util.UUID;
|
|
|
20
20
|
@CapacitorPlugin(name = "FileCompressor")
|
|
21
21
|
public class FileCompressorPlugin extends Plugin {
|
|
22
22
|
|
|
23
|
-
private final String pluginVersion = "8.1.
|
|
23
|
+
private final String pluginVersion = "8.1.4";
|
|
24
24
|
private static final float MIN_QUALITY = 0.1f;
|
|
25
25
|
private static final float QUALITY_STEP = 0.05f;
|
|
26
26
|
private static final List<String> SUPPORTED_OUTPUT_MIME_TYPES = Arrays.asList("image/jpeg", "image/png", "image/webp");
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FileCompressor = registerPlugin('FileCompressor', {\n web: () => import('./web').then((m) => new m.FileCompressorWeb()),\n});\nexport * from './definitions';\nexport { FileCompressor };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst SUPPORTED_OUTPUT_MIME_TYPES = ['image/jpeg', 'image/png', 'image/webp'];\nexport class FileCompressorWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.minimumQuality = 0.1;\n this.qualityStep = 0.05;\n }\n async compressImage(options) {\n var _a, _b;\n if (!options.blob) {\n throw new Error('blob is required on web platform');\n }\n const quality = (_a = options.quality) !== null && _a !== void 0 ? _a : 0.6;\n const mimeType = ((_b = options.mimeType) !== null && _b !== void 0 ? _b : 'image/jpeg').toLowerCase();\n if (!SUPPORTED_OUTPUT_MIME_TYPES.includes(mimeType)) {\n throw new Error(`Unsupported output mimeType: ${mimeType}. Supported: ${SUPPORTED_OUTPUT_MIME_TYPES.join(', ')}`);\n }\n const img = await this.createImageFromBlob(options.blob);\n const { width, height } = this.calculateDimensions(img, options.width, options.height);\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Failed to get canvas context');\n }\n ctx.drawImage(img, 0, 0, width, height);\n const blob = await this.canvasToBlobWithinSize(canvas, mimeType, quality, options.blob.size);\n return { blob };\n }\n async getPluginVersion() {\n return { version: '7.0.0' };\n }\n calculateDimensions(img, maxWidth, maxHeight) {\n let width = img.width;\n let height = img.height;\n if (maxWidth != null && maxHeight != null) {\n const ratio = Math.min(maxWidth / width, maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxWidth != null) {\n const ratio = Math.min(maxWidth / width, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxHeight != null) {\n const ratio = Math.min(maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n return { width, height };\n }\n async canvasToBlobWithinSize(canvas, mimeType, quality, maxBytes) {\n let currentQuality = quality;\n const supportsQuality = mimeType !== 'image/png';\n while (true) {\n const blob = await this.canvasToBlob(canvas, mimeType, currentQuality);\n if (blob.size <= maxBytes || currentQuality <= this.minimumQuality || !supportsQuality) {\n return blob;\n }\n currentQuality = Math.max(this.minimumQuality, currentQuality - this.qualityStep);\n }\n }\n canvasToBlob(canvas, mimeType, quality) {\n return new Promise((resolve, reject) => {\n canvas.toBlob((blob) => {\n if (blob) {\n resolve(blob);\n }\n else {\n reject(new Error('Failed to create blob from canvas'));\n }\n }, mimeType, quality);\n });\n }\n createImageFromBlob(blob) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n const url = URL.createObjectURL(blob);\n img.onload = () => {\n URL.revokeObjectURL(url);\n resolve(img);\n };\n img.onerror = () => {\n URL.revokeObjectURL(url);\n reject(new Error('Failed to load image from blob'));\n };\n img.src = url;\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;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version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FileCompressor = registerPlugin('FileCompressor', {\n web: () => import('./web').then((m) => new m.FileCompressorWeb()),\n});\nexport * from './definitions';\nexport { FileCompressor };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst SUPPORTED_OUTPUT_MIME_TYPES = ['image/jpeg', 'image/png', 'image/webp'];\nexport class FileCompressorWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.minimumQuality = 0.1;\n this.qualityStep = 0.05;\n }\n async compressImage(options) {\n var _a, _b;\n if (!options.blob) {\n throw new Error('blob is required on web platform');\n }\n const quality = (_a = options.quality) !== null && _a !== void 0 ? _a : 0.6;\n const mimeType = ((_b = options.mimeType) !== null && _b !== void 0 ? _b : 'image/jpeg').toLowerCase();\n if (!SUPPORTED_OUTPUT_MIME_TYPES.includes(mimeType)) {\n throw new Error(`Unsupported output mimeType: ${mimeType}. Supported: ${SUPPORTED_OUTPUT_MIME_TYPES.join(', ')}`);\n }\n const img = await this.createImageFromBlob(options.blob);\n const { width, height } = this.calculateDimensions(img, options.width, options.height);\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Failed to get canvas context');\n }\n ctx.drawImage(img, 0, 0, width, height);\n const blob = await this.canvasToBlobWithinSize(canvas, mimeType, quality, options.blob.size);\n return { blob };\n }\n async getPluginVersion() {\n return { version: '7.0.0' };\n }\n calculateDimensions(img, maxWidth, maxHeight) {\n let width = img.width;\n let height = img.height;\n if (maxWidth != null && maxHeight != null) {\n const ratio = Math.min(maxWidth / width, maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxWidth != null) {\n const ratio = Math.min(maxWidth / width, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxHeight != null) {\n const ratio = Math.min(maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n return { width, height };\n }\n async canvasToBlobWithinSize(canvas, mimeType, quality, maxBytes) {\n let currentQuality = quality;\n const supportsQuality = mimeType !== 'image/png';\n while (true) {\n const blob = await this.canvasToBlob(canvas, mimeType, currentQuality);\n if (blob.size <= maxBytes || currentQuality <= this.minimumQuality || !supportsQuality) {\n return blob;\n }\n currentQuality = Math.max(this.minimumQuality, currentQuality - this.qualityStep);\n }\n }\n canvasToBlob(canvas, mimeType, quality) {\n return new Promise((resolve, reject) => {\n canvas.toBlob((blob) => {\n if (blob) {\n resolve(blob);\n }\n else {\n reject(new Error('Failed to create blob from canvas'));\n }\n }, mimeType, quality);\n });\n }\n createImageFromBlob(blob) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n const url = URL.createObjectURL(blob);\n img.onload = () => {\n URL.revokeObjectURL(url);\n resolve(img);\n };\n img.onerror = () => {\n URL.revokeObjectURL(url);\n reject(new Error('Failed to load image from blob'));\n };\n img.src = url;\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACrE,CAAC;;ACFD,MAAM,2BAA2B,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;AACtE,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,cAAc,GAAG,GAAG;AACjC,QAAQ,IAAI,CAAC,WAAW,GAAG,IAAI;AAC/B,IAAI;AACJ,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;AACjC,QAAQ,IAAI,EAAE,EAAE,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AAQ,EAAE,OAAO,CAAC;AACjC,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ,IAAI,mBAAmB,CAAC,IAAI,EAAE;AAC9B,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE;AACnC,YAAY,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;AACjD,YAAY,GAAG,CAAC,MAAM,GAAG,MAAM;AAC/B,gBAAgB,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC;AACxC,gBAAgB,OAAO,CAAC,GAAG,CAAC;AAC5B,YAAY,CAAC;AACb,YAAY,GAAG,CAAC,OAAO,GAAG,MAAM;AAChC,gBAAgB,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC;AACxC,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACnE,YAAY,CAAC;AACb,YAAY,GAAG,CAAC,GAAG,GAAG,GAAG;AACzB,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;;;;"}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FileCompressor = registerPlugin('FileCompressor', {\n web: () => import('./web').then((m) => new m.FileCompressorWeb()),\n});\nexport * from './definitions';\nexport { FileCompressor };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst SUPPORTED_OUTPUT_MIME_TYPES = ['image/jpeg', 'image/png', 'image/webp'];\nexport class FileCompressorWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.minimumQuality = 0.1;\n this.qualityStep = 0.05;\n }\n async compressImage(options) {\n var _a, _b;\n if (!options.blob) {\n throw new Error('blob is required on web platform');\n }\n const quality = (_a = options.quality) !== null && _a !== void 0 ? _a : 0.6;\n const mimeType = ((_b = options.mimeType) !== null && _b !== void 0 ? _b : 'image/jpeg').toLowerCase();\n if (!SUPPORTED_OUTPUT_MIME_TYPES.includes(mimeType)) {\n throw new Error(`Unsupported output mimeType: ${mimeType}. Supported: ${SUPPORTED_OUTPUT_MIME_TYPES.join(', ')}`);\n }\n const img = await this.createImageFromBlob(options.blob);\n const { width, height } = this.calculateDimensions(img, options.width, options.height);\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Failed to get canvas context');\n }\n ctx.drawImage(img, 0, 0, width, height);\n const blob = await this.canvasToBlobWithinSize(canvas, mimeType, quality, options.blob.size);\n return { blob };\n }\n async getPluginVersion() {\n return { version: '7.0.0' };\n }\n calculateDimensions(img, maxWidth, maxHeight) {\n let width = img.width;\n let height = img.height;\n if (maxWidth != null && maxHeight != null) {\n const ratio = Math.min(maxWidth / width, maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxWidth != null) {\n const ratio = Math.min(maxWidth / width, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxHeight != null) {\n const ratio = Math.min(maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n return { width, height };\n }\n async canvasToBlobWithinSize(canvas, mimeType, quality, maxBytes) {\n let currentQuality = quality;\n const supportsQuality = mimeType !== 'image/png';\n while (true) {\n const blob = await this.canvasToBlob(canvas, mimeType, currentQuality);\n if (blob.size <= maxBytes || currentQuality <= this.minimumQuality || !supportsQuality) {\n return blob;\n }\n currentQuality = Math.max(this.minimumQuality, currentQuality - this.qualityStep);\n }\n }\n canvasToBlob(canvas, mimeType, quality) {\n return new Promise((resolve, reject) => {\n canvas.toBlob((blob) => {\n if (blob) {\n resolve(blob);\n }\n else {\n reject(new Error('Failed to create blob from canvas'));\n }\n }, mimeType, quality);\n });\n }\n createImageFromBlob(blob) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n const url = URL.createObjectURL(blob);\n img.onload = () => {\n URL.revokeObjectURL(url);\n resolve(img);\n };\n img.onerror = () => {\n URL.revokeObjectURL(url);\n reject(new Error('Failed to load image from blob'));\n };\n img.src = url;\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;IACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrE,CAAC;;ICFD,MAAM,2BAA2B,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;IACtE,MAAM,iBAAiB,SAASC,cAAS,CAAC;IACjD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,cAAc,GAAG,GAAG;IACjC,QAAQ,IAAI,CAAC,WAAW,GAAG,IAAI;IAC/B,IAAI;IACJ,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;IACjC,QAAQ,IAAI,EAAE,EAAE,EAAE;IAClB,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;IAC3B,YAAY,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC;IAC/D,QAAQ;IACR,QAAQ,MAAM,OAAO,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,GAAG;IACnF,QAAQ,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,YAAY,EAAE,WAAW,EAAE;IAC9G,QAAQ,IAAI,CAAC,2BAA2B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IA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C,gBAAgB,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC;IACxC,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACnE,YAAY,CAAC;IACb,YAAY,GAAG,CAAC,GAAG,GAAG,GAAG;IACzB,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FileCompressor = registerPlugin('FileCompressor', {\n web: () => import('./web').then((m) => new m.FileCompressorWeb()),\n});\nexport * from './definitions';\nexport { FileCompressor };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst SUPPORTED_OUTPUT_MIME_TYPES = ['image/jpeg', 'image/png', 'image/webp'];\nexport class FileCompressorWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.minimumQuality = 0.1;\n this.qualityStep = 0.05;\n }\n async compressImage(options) {\n var _a, _b;\n if (!options.blob) {\n throw new Error('blob is required on web platform');\n }\n const quality = (_a = options.quality) !== null && _a !== void 0 ? _a : 0.6;\n const mimeType = ((_b = options.mimeType) !== null && _b !== void 0 ? _b : 'image/jpeg').toLowerCase();\n if (!SUPPORTED_OUTPUT_MIME_TYPES.includes(mimeType)) {\n throw new Error(`Unsupported output mimeType: ${mimeType}. Supported: ${SUPPORTED_OUTPUT_MIME_TYPES.join(', ')}`);\n }\n const img = await this.createImageFromBlob(options.blob);\n const { width, height } = this.calculateDimensions(img, options.width, options.height);\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Failed to get canvas context');\n }\n ctx.drawImage(img, 0, 0, width, height);\n const blob = await this.canvasToBlobWithinSize(canvas, mimeType, quality, options.blob.size);\n return { blob };\n }\n async getPluginVersion() {\n return { version: '7.0.0' };\n }\n calculateDimensions(img, maxWidth, maxHeight) {\n let width = img.width;\n let height = img.height;\n if (maxWidth != null && maxHeight != null) {\n const ratio = Math.min(maxWidth / width, maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxWidth != null) {\n const ratio = Math.min(maxWidth / width, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n else if (maxHeight != null) {\n const ratio = Math.min(maxHeight / height, 1);\n width = Math.round(width * ratio);\n height = Math.round(height * ratio);\n }\n return { width, height };\n }\n async canvasToBlobWithinSize(canvas, mimeType, quality, maxBytes) {\n let currentQuality = quality;\n const supportsQuality = mimeType !== 'image/png';\n while (true) {\n const blob = await this.canvasToBlob(canvas, mimeType, currentQuality);\n if (blob.size <= maxBytes || currentQuality <= this.minimumQuality || !supportsQuality) {\n return blob;\n }\n currentQuality = Math.max(this.minimumQuality, currentQuality - this.qualityStep);\n }\n }\n canvasToBlob(canvas, mimeType, quality) {\n return new Promise((resolve, reject) => {\n canvas.toBlob((blob) => {\n if (blob) {\n resolve(blob);\n }\n else {\n reject(new Error('Failed to create blob from canvas'));\n }\n }, mimeType, quality);\n });\n }\n createImageFromBlob(blob) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n const url = URL.createObjectURL(blob);\n img.onload = () => {\n URL.revokeObjectURL(url);\n resolve(img);\n };\n img.onerror = () => {\n URL.revokeObjectURL(url);\n reject(new Error('Failed to load image from blob'));\n };\n img.src = url;\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;IACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrE,CAAC;;ICFD,MAAM,2BAA2B,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;IACtE,MAAM,iBAAiB,SAASC,cAAS,CAAC;IACjD,IAAI,WAAW,GA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C,IAAI,KAAK;IACpC,gBAAgB,IAAI,IAAI,EAAE;IAC1B,oBAAoB,OAAO,CAAC,IAAI,CAAC;IACjC,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAC1E,gBAAgB;IAChB,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ,IAAI,mBAAmB,CAAC,IAAI,EAAE;IAC9B,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;IAChD,YAAY,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE;IACnC,YAAY,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;IACjD,YAAY,GAAG,CAAC,MAAM,GAAG,MAAM;IAC/B,gBAAgB,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC;IACxC,gBAAgB,OAAO,CAAC,GAAG,CAAC;IAC5B,YAAY,CAAC;IACb,YAAY,GAAG,CAAC,OAAO,GAAG,MAAM;IAChC,gBAAgB,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC;IACxC,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACnE,YAAY,CAAC;IACb,YAAY,GAAG,CAAC,GAAG,GAAG,GAAG;IACzB,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;"}
|
|
@@ -6,7 +6,7 @@ import UniformTypeIdentifiers
|
|
|
6
6
|
|
|
7
7
|
@objc(FileCompressorPlugin)
|
|
8
8
|
public class FileCompressorPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
9
|
-
private let pluginVersion: String = "8.1.
|
|
9
|
+
private let pluginVersion: String = "8.1.4"
|
|
10
10
|
private let minimumQuality: CGFloat = 0.1
|
|
11
11
|
private let qualityStep: CGFloat = 0.05
|
|
12
12
|
public let identifier = "FileCompressorPlugin"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-file-compressor",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.4",
|
|
4
4
|
"description": "Capacitor plugin for efficient image compression supporting PNG, JPEG, and WebP formats across iOS, Android, and Web platforms",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|