@shibam/sticker-maker 1.1.6 โ†’ 1.1.8

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/dist/index.js CHANGED
@@ -1,19 +1,22 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const utils_js_1 = __importDefault(require("./lib/utils.js"));
8
- const ToWebp_js_1 = __importDefault(require("./lib/ToWebp.js"));
9
- const StickerTypes_js_1 = require("./types/StickerTypes.js");
10
- const changeMetaInfo_js_1 = __importDefault(require("./lib/changeMetaInfo.js"));
11
- const extractMetaData_js_1 = __importDefault(require("./lib/extractMetaData.js"));
1
+ import fs from 'fs';
2
+ import Utils from './lib/utils.js';
3
+ import convert from './lib/ToWebp.js';
4
+ import { StickerTypes } from './types/StickerTypes.js';
5
+ import MetaInfoChanger from './lib/changeMetaInfo.js';
6
+ import extractMetaData from './lib/extractMetaData.js';
12
7
  class Sticker {
8
+ data;
9
+ metaInfo;
10
+ buffer;
11
+ mimeType;
12
+ extType;
13
+ utils = new Utils();
14
+ outBuffer;
15
+ activeBuff;
16
+ activeMeta;
13
17
  constructor(data, metaInfo = {}) {
14
18
  this.data = data;
15
19
  this.metaInfo = metaInfo;
16
- this.utils = new utils_js_1.default();
17
20
  this.buffer = Buffer.from([]);
18
21
  this.outBuffer = Buffer.from([]);
19
22
  this.activeBuff = false;
@@ -37,7 +40,7 @@ class Sticker {
37
40
  this.metaInfo.author = this.metaInfo.author ?? '';
38
41
  this.metaInfo.id = this.metaInfo.id ?? this.utils.getId();
39
42
  this.metaInfo.category = this.metaInfo.category ?? [];
40
- this.metaInfo.type = this.metaInfo.type ?? StickerTypes_js_1.StickerTypes.DEFAULT;
43
+ this.metaInfo.type = this.metaInfo.type ?? StickerTypes.DEFAULT;
41
44
  this.metaInfo.quality = this.metaInfo?.quality ?? this.utils.getQuality(this.buffer);
42
45
  }
43
46
  catch (error) {
@@ -51,8 +54,8 @@ class Sticker {
51
54
  async toBuffer() {
52
55
  try {
53
56
  await this.initialize();
54
- const buffer = await (0, ToWebp_js_1.default)(this.buffer, this.metaInfo, this.extType, this.mimeType);
55
- this.outBuffer = await new changeMetaInfo_js_1.default(this.metaInfo).add(buffer);
57
+ const buffer = await convert(this.buffer, this.metaInfo, this.extType, this.mimeType);
58
+ this.outBuffer = await new MetaInfoChanger(this.metaInfo).add(buffer);
56
59
  this.activeBuff = true;
57
60
  return this.outBuffer;
58
61
  }
@@ -74,7 +77,7 @@ class Sticker {
74
77
  else {
75
78
  await this.toBuffer();
76
79
  }
77
- await fs_1.default.promises.writeFile(outputPath, this.outBuffer);
80
+ await fs.promises.writeFile(outputPath, this.outBuffer);
78
81
  }
79
82
  catch (error) {
80
83
  throw new Error(`Conversion to file failed: ${error}`);
@@ -88,7 +91,7 @@ class Sticker {
88
91
  async changeMetaInfo() {
89
92
  try {
90
93
  await this.initialize();
91
- this.outBuffer = await new changeMetaInfo_js_1.default(this.metaInfo).add(this.buffer);
94
+ this.outBuffer = await new MetaInfoChanger(this.metaInfo).add(this.buffer);
92
95
  this.activeMeta = true;
93
96
  return this.outBuffer;
94
97
  }
@@ -105,11 +108,11 @@ class Sticker {
105
108
  async extractMetaData(data) {
106
109
  try {
107
110
  await this.initialize();
108
- return (0, extractMetaData_js_1.default)(data);
111
+ return extractMetaData(data);
109
112
  }
110
113
  catch (error) {
111
114
  throw new Error(`Error extracting meta data: ${error}`);
112
115
  }
113
116
  }
114
117
  }
115
- exports.default = { Sticker, StickerTypes: StickerTypes_js_1.StickerTypes };
118
+ export default { Sticker, StickerTypes };
@@ -1,34 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const sharp_1 = __importStar(require("sharp"));
30
- const StickerTypes_js_1 = require("../types/StickerTypes.js");
31
- const toGif_js_1 = __importDefault(require("./toGif.js"));
1
+ import sharp, { fit } from 'sharp';
2
+ import { StickerTypes } from '../types/StickerTypes.js';
3
+ import toGif from './toGif.js';
32
4
  /**
33
5
  * Converts a given buffer to WebP format with optional transformations.
34
6
  *
@@ -43,13 +15,13 @@ const ToWebp = async (buffer, metaInfo, mimeExt, mimeType) => {
43
15
  if (mimeExt === 'webp')
44
16
  return buffer;
45
17
  let data = mimeType?.includes('video')
46
- ? await (0, toGif_js_1.default)(buffer, mimeExt, metaInfo.type || StickerTypes_js_1.StickerTypes.DEFAULT)
18
+ ? await toGif(buffer, mimeExt, metaInfo.type || StickerTypes.DEFAULT)
47
19
  : buffer;
48
20
  let isAnimated = mimeType?.includes('video') || mimeExt?.includes('gif');
49
- const res = (0, sharp_1.default)(data, { animated: isAnimated });
50
- if (metaInfo.type === StickerTypes_js_1.StickerTypes.CIRCLE) {
21
+ const res = sharp(data, { animated: isAnimated });
22
+ if (metaInfo.type === StickerTypes.CIRCLE) {
51
23
  res.resize(512, 512, {
52
- fit: sharp_1.fit.cover
24
+ fit: fit.cover
53
25
  }).composite([
54
26
  {
55
27
  input: Buffer.from(`<svg width="512" height="512"><circle cx="256" cy="256" r="256" fill=""/></svg>`),
@@ -59,14 +31,14 @@ const ToWebp = async (buffer, metaInfo, mimeExt, mimeType) => {
59
31
  }
60
32
  ]);
61
33
  }
62
- else if (metaInfo.type === StickerTypes_js_1.StickerTypes.SQUARE && !mimeType?.includes('video')) {
34
+ else if (metaInfo.type === StickerTypes.SQUARE && !mimeType?.includes('video')) {
63
35
  res.resize(512, 512, {
64
- fit: sharp_1.fit.fill
36
+ fit: fit.fill
65
37
  });
66
38
  }
67
39
  else {
68
40
  res.resize(512, 512, {
69
- fit: sharp_1.fit.contain,
41
+ fit: fit.contain,
70
42
  background: { r: 0, g: 0, b: 0, alpha: 0 }
71
43
  });
72
44
  }
@@ -82,4 +54,4 @@ const ToWebp = async (buffer, metaInfo, mimeExt, mimeType) => {
82
54
  throw new Error(`Conversion failed: ${error}`);
83
55
  }
84
56
  };
85
- exports.default = ToWebp;
57
+ export default ToWebp;
@@ -1,62 +1,56 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const node_webpmux_1 = __importDefault(require("node-webpmux"));
7
- const util_1 = require("util");
1
+ import Image from 'node-webpmux';
2
+ import { TextEncoder } from 'util';
8
3
  /**
9
4
  * The Exif class is responsible for handling the metadata (Exif data)
10
5
  * for sticker images, particularly those used in messaging applications.
11
6
  */
12
- class Exif {
7
+ export default class Exif {
8
+ data = {};
9
+ exif = null;
13
10
  /**
14
11
  * Constructs an Exif instance with the given options.
15
12
  * @param options - An object containing metadata for the sticker.
16
13
  */
17
14
  constructor(options) {
18
- this.data = {};
19
- this.exif = null;
20
- /**
21
- * Builds the Exif metadata as a Buffer.
22
- * @returns A Buffer containing the constructed Exif data.
23
- */
24
- this.build = () => {
25
- const data = JSON.stringify(this.data);
26
- const exif = Buffer.concat([
27
- Buffer.from([
28
- 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00,
29
- 0x00, 0x16, 0x00, 0x00, 0x00
30
- ]),
31
- Buffer.from(data, 'utf-8')
32
- ]);
33
- exif.writeUIntLE(new util_1.TextEncoder().encode(data).length, 14, 4);
34
- return exif;
35
- };
36
- /**
37
- * Adds the Exif metadata to the given image.
38
- * @param image - A Buffer or Image instance representing the image to which Exif data should be added.
39
- * @returns A Promise that resolves to a Buffer containing the image with the added Exif data.
40
- */
41
- this.add = async (image) => {
42
- const exif = this.exif || this.build();
43
- // Load the image if it is not already an instance of Image.Image.
44
- image =
45
- image instanceof node_webpmux_1.default.Image
46
- ? image
47
- : await (async () => {
48
- const img = new node_webpmux_1.default.Image();
49
- await img.load(image);
50
- return img;
51
- })();
52
- // Set the Exif data on the image and save it.
53
- image.exif = exif;
54
- return await image.save(null);
55
- };
56
15
  this.data['sticker-pack-id'] = options.id || '';
57
16
  this.data['sticker-pack-name'] = options.pack || '';
58
17
  this.data['sticker-pack-publisher'] = options.author || '';
59
18
  this.data['emojis'] = options.category || ['๐Ÿ˜น'];
60
19
  }
20
+ /**
21
+ * Builds the Exif metadata as a Buffer.
22
+ * @returns A Buffer containing the constructed Exif data.
23
+ */
24
+ build = () => {
25
+ const data = JSON.stringify(this.data);
26
+ const exif = Buffer.concat([
27
+ Buffer.from([
28
+ 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00,
29
+ 0x00, 0x16, 0x00, 0x00, 0x00
30
+ ]),
31
+ Buffer.from(data, 'utf-8')
32
+ ]);
33
+ exif.writeUIntLE(new TextEncoder().encode(data).length, 14, 4);
34
+ return exif;
35
+ };
36
+ /**
37
+ * Adds the Exif metadata to the given image.
38
+ * @param image - A Buffer or Image instance representing the image to which Exif data should be added.
39
+ * @returns A Promise that resolves to a Buffer containing the image with the added Exif data.
40
+ */
41
+ add = async (image) => {
42
+ const exif = this.exif || this.build();
43
+ // Load the image if it is not already an instance of Image.Image.
44
+ image =
45
+ image instanceof Image.Image
46
+ ? image
47
+ : await (async () => {
48
+ const img = new Image.Image();
49
+ await img.load(image);
50
+ return img;
51
+ })();
52
+ // Set the Exif data on the image and save it.
53
+ image.exif = exif;
54
+ return await image.save(null);
55
+ };
61
56
  }
62
- exports.default = Exif;
@@ -1,17 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const node_webpmux_1 = __importDefault(require("node-webpmux"));
1
+ import Image from 'node-webpmux';
7
2
  /**
8
3
  * Extracts metadata from a WebP image.
9
4
  * @param {Buffer}image - The image buffer to extract metadata from
10
5
  */
11
6
  const extractMetadata = async (image) => {
12
- const img = new node_webpmux_1.default.Image();
7
+ const img = new Image.Image();
13
8
  await img.load(image);
14
9
  const exif = img.exif?.toString('utf-8') ?? '{}';
15
10
  return JSON.parse(exif.substring(exif.indexOf('{'), exif.lastIndexOf('}') + 1) ?? '{}');
16
11
  };
17
- exports.default = extractMetadata;
12
+ export default extractMetadata;
package/dist/lib/toGif.js CHANGED
@@ -1,18 +1,13 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fluent_ffmpeg_1 = __importDefault(require("fluent-ffmpeg"));
7
- const ffmpeg_1 = __importDefault(require("@ffmpeg-installer/ffmpeg"));
8
- const stream_1 = require("stream");
9
- const StickerTypes_js_1 = require("../types/StickerTypes.js");
10
- fluent_ffmpeg_1.default.setFfmpegPath(ffmpeg_1.default.path);
1
+ import ffmpeg from 'fluent-ffmpeg';
2
+ import ffmpegInstaller from '@ffmpeg-installer/ffmpeg';
3
+ import { PassThrough } from 'stream';
4
+ import { StickerTypes } from '../types/StickerTypes.js';
5
+ ffmpeg.setFfmpegPath(ffmpegInstaller.path);
11
6
  const videoToGif = (buffer, extType, type) => {
12
7
  return new Promise(async (resolve, reject) => {
13
8
  try {
14
- const outputStream = new stream_1.PassThrough({ allowHalfOpen: false });
15
- const inputStream = new stream_1.PassThrough({ allowHalfOpen: false });
9
+ const outputStream = new PassThrough({ allowHalfOpen: false });
10
+ const inputStream = new PassThrough({ allowHalfOpen: false });
16
11
  inputStream.write(buffer);
17
12
  inputStream.end();
18
13
  const chunks = [];
@@ -29,10 +24,10 @@ const videoToGif = (buffer, extType, type) => {
29
24
  inputStream.destroy();
30
25
  outputStream.destroy();
31
26
  });
32
- const shape = type === StickerTypes_js_1.StickerTypes.SQUARE
27
+ const shape = type === StickerTypes.SQUARE
33
28
  ? 'scale=320:-1:flags=lanczos,fps=10,crop=min(iw\\,ih):min(iw\\,ih)'
34
29
  : 'scale=320:-1:flags=lanczos,fps=10';
35
- (0, fluent_ffmpeg_1.default)(inputStream)
30
+ ffmpeg(inputStream)
36
31
  .inputFormat(extType)
37
32
  .outputOptions(['-vf', shape, '-loop', '0', '-lossless', '0', '-t', '7', '-preset', 'ultrafast'])
38
33
  .toFormat('gif')
@@ -48,4 +43,4 @@ const videoToGif = (buffer, extType, type) => {
48
43
  }
49
44
  });
50
45
  };
51
- exports.default = videoToGif;
46
+ export default videoToGif;
package/dist/lib/utils.js CHANGED
@@ -1,34 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const stream_1 = require("stream");
30
- const fs_1 = __importDefault(require("fs"));
31
- class Utils {
1
+ import { Readable } from 'stream';
2
+ import fs from 'fs';
3
+ export default class Utils {
32
4
  constructor() { }
33
5
  /**
34
6
  * Converts various types of input data to a Buffer.
@@ -39,8 +11,8 @@ class Utils {
39
11
  async buffer(data) {
40
12
  try {
41
13
  const buffer = typeof data === 'string'
42
- ? await fs_1.default.promises.readFile(data)
43
- : data instanceof stream_1.Readable
14
+ ? await fs.promises.readFile(data)
15
+ : data instanceof Readable
44
16
  ? await this.streamToBuffer(data)
45
17
  : Buffer.from(data);
46
18
  return buffer;
@@ -91,7 +63,7 @@ class Utils {
91
63
  */
92
64
  async getMimeType(data) {
93
65
  try {
94
- const { fileTypeFromBuffer } = await Promise.resolve().then(() => __importStar(require('file-type')));
66
+ const { fileTypeFromBuffer } = await import('file-type');
95
67
  const fileType = await fileTypeFromBuffer(data);
96
68
  return fileType;
97
69
  }
@@ -108,4 +80,3 @@ class Utils {
108
80
  return [...Array(5)].map(() => Math.random().toString(36).substring(2, 15)).join('');
109
81
  }
110
82
  }
111
- exports.default = Utils;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StickerTypes = void 0;
4
- var StickerTypes;
1
+ export var StickerTypes;
5
2
  (function (StickerTypes) {
6
3
  StickerTypes[StickerTypes["DEFAULT"] = 0] = "DEFAULT";
7
4
  StickerTypes[StickerTypes["SQUARE"] = 1] = "SQUARE";
8
5
  StickerTypes[StickerTypes["CIRCLE"] = 2] = "CIRCLE";
9
- })(StickerTypes || (exports.StickerTypes = StickerTypes = {}));
6
+ })(StickerTypes || (StickerTypes = {}));
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shibam/sticker-maker",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "A package for creating stickers",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "repository": {
23
23
  "type": "git",
24
- "url": "https://github.com/NekoSenpai69/Sticker-Maker.git"
24
+ "url": "https://github.com/ShibamDey69/Sticker-Maker.git"
25
25
  },
26
26
  "keywords": [
27
27
  "stickers",
package/dist/index.d.ts DELETED
@@ -1,50 +0,0 @@
1
- import { Readable } from 'stream';
2
- import { MetaDataType } from './types/metaInfoType.js';
3
- import { StickerTypes } from './types/StickerTypes.js';
4
- declare class Sticker {
5
- private data;
6
- metaInfo: Partial<MetaDataType>;
7
- private buffer;
8
- private mimeType;
9
- private extType;
10
- private utils;
11
- private outBuffer;
12
- private activeBuff;
13
- private activeMeta;
14
- constructor(data: Buffer | string | Readable, metaInfo?: Partial<MetaDataType>);
15
- /**
16
- * Initializes the Sticker instance.
17
- * - Sets default values for metaInfo.
18
- * - Reads and analyzes input data to determine MIME type and extension type.
19
- * - Generates ID and quality metadata if not provided.
20
- */
21
- private initialize;
22
- /**
23
- * Converts input data to a Buffer containing the converted content.
24
- * @returns Promise<Buffer> A Promise resolving to the converted content as Buffer.
25
- */
26
- toBuffer(): Promise<Buffer>;
27
- /**
28
- * Converts input data and writes it to a file at the specified outputPath.
29
- * @param outputPath The path where the converted file will be saved.
30
- * @returns Promise<void> A Promise resolving when the file is successfully written.
31
- */
32
- toFile(outputPath: string): Promise<void>;
33
- /**
34
- * Changes the metadata of the sticker.
35
- * @param newMetaInfo Partial metadata to update.
36
- * @returns Promise<Buffer> A Promise resolving to the Buffer with updated metadata.
37
- */
38
- changeMetaInfo(): Promise<Buffer>;
39
- /**
40
- * Extracts metadata from the provided data.
41
- * @param data Buffer containing the data to extract metadata from.
42
- * @returns Promise<Partial<MetaDataType>> A Promise resolving to the extracted metadata.
43
- */
44
- extractMetaData(data: Buffer): Promise<Partial<MetaDataType>>;
45
- }
46
- declare const _default: {
47
- Sticker: typeof Sticker;
48
- StickerTypes: typeof StickerTypes;
49
- };
50
- export default _default;
@@ -1,12 +0,0 @@
1
- import { MetaDataType } from '../types/metaInfoType.js';
2
- /**
3
- * Converts a given buffer to WebP format with optional transformations.
4
- *
5
- * @param {Buffer} buffer - The input buffer to be converted.
6
- * @param {Partial<MetaDataType>} metaInfo - Metadata information for the conversion.
7
- * @param {string} mimeExt - The MIME extension of the input buffer.
8
- * @param {string} mimeType - The MIME type of the input buffer.
9
- * @returns {Promise<Buffer>} - A promise that resolves to the converted WebP buffer.
10
- */
11
- declare const ToWebp: (buffer: Buffer, metaInfo: Partial<MetaDataType>, mimeExt: string, mimeType: string) => Promise<Buffer>;
12
- export default ToWebp;
@@ -1,25 +0,0 @@
1
- import Image from 'node-webpmux';
2
- /**
3
- * The Exif class is responsible for handling the metadata (Exif data)
4
- * for sticker images, particularly those used in messaging applications.
5
- */
6
- export default class Exif {
7
- private data;
8
- private exif;
9
- /**
10
- * Constructs an Exif instance with the given options.
11
- * @param options - An object containing metadata for the sticker.
12
- */
13
- constructor(options: any);
14
- /**
15
- * Builds the Exif metadata as a Buffer.
16
- * @returns A Buffer containing the constructed Exif data.
17
- */
18
- build: () => Buffer;
19
- /**
20
- * Adds the Exif metadata to the given image.
21
- * @param image - A Buffer or Image instance representing the image to which Exif data should be added.
22
- * @returns A Promise that resolves to a Buffer containing the image with the added Exif data.
23
- */
24
- add: (image: Buffer | Image.Image) => Promise<Buffer>;
25
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Extracts metadata from a WebP image.
3
- * @param {Buffer}image - The image buffer to extract metadata from
4
- */
5
- declare const extractMetadata: (image: Buffer) => Promise<any>;
6
- export default extractMetadata;
@@ -1,3 +0,0 @@
1
- import { StickerTypes } from '../types/StickerTypes.js';
2
- declare const videoToGif: (buffer: Buffer, extType: string, type: StickerTypes) => Promise<Buffer>;
3
- export default videoToGif;
@@ -1,37 +0,0 @@
1
- import { Readable } from 'stream';
2
- export default class Utils {
3
- constructor();
4
- /**
5
- * Converts various types of input data to a Buffer.
6
- * @param data Input data as Buffer, string (file path), or Readable stream.
7
- * @returns Promise<Buffer> A Promise resolving to the converted Buffer.
8
- * @throws Error if conversion fails.
9
- */
10
- buffer(data: Buffer | string | Readable): Promise<Buffer>;
11
- /**
12
- * Converts a Readable stream to a Buffer.
13
- * @param stream Readable stream to convert.
14
- * @returns Promise<Buffer> A Promise resolving to the converted Buffer.
15
- */
16
- streamToBuffer(stream: Readable): Promise<Buffer>;
17
- /**
18
- * Determines the quality of the data based on its size.
19
- * @param data Buffer containing the data.
20
- * @returns number Quality value based on data size.
21
- */
22
- getQuality(data: Buffer): number;
23
- /**
24
- * Determines the MIME type of the data buffer.
25
- * @param data Buffer containing the data.
26
- * @returns Promise<{ mime: string; ext: string }> A Promise resolving to an object with MIME type and extension.
27
- */
28
- getMimeType(data: Buffer): Promise<{
29
- mime: string;
30
- ext: string;
31
- } | undefined>;
32
- /**
33
- * Generates a random ID.
34
- * @returns string A random alphanumeric ID.
35
- */
36
- getId(): string;
37
- }
@@ -1,5 +0,0 @@
1
- export declare enum StickerTypes {
2
- DEFAULT = 0,
3
- SQUARE = 1,
4
- CIRCLE = 2
5
- }
@@ -1,8 +0,0 @@
1
- type LoveEmojis = 'โค' | '๐Ÿ˜' | '๐Ÿ˜˜' | '๐Ÿ’•' | '๐Ÿ˜ป' | '๐Ÿ’‘' | '๐Ÿ‘ฉโ€โคโ€๐Ÿ‘ฉ' | '๐Ÿ‘จโ€โคโ€๐Ÿ‘จ' | '๐Ÿ’' | '๐Ÿ‘ฉโ€โคโ€๐Ÿ’‹โ€๐Ÿ‘ฉ' | '๐Ÿ‘จโ€โคโ€๐Ÿ’‹โ€๐Ÿ‘จ' | '๐Ÿงก' | '๐Ÿ’›' | '๐Ÿ’š' | '๐Ÿ’™' | '๐Ÿ’œ' | '๐Ÿ–ค' | '๐Ÿ’”' | 'โฃ' | '๐Ÿ’ž' | '๐Ÿ’“' | '๐Ÿ’—' | '๐Ÿ’–' | '๐Ÿ’˜' | '๐Ÿ’' | '๐Ÿ’Ÿ' | 'โ™ฅ' | '๐Ÿ’Œ' | '๐Ÿ’‹' | '๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘ฉ' | '๐Ÿ‘จโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘จ' | '๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘จ' | '๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘ฉ' | '๐Ÿ‘จโ€โค๏ธโ€๐Ÿ‘จ' | '๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿ‘จ' | '๐Ÿ‘ฌ' | '๐Ÿ‘ญ' | '๐Ÿ‘ซ' | '๐Ÿฅฐ' | '๐Ÿ˜š' | '๐Ÿ˜™' | '๐Ÿ‘„' | '๐ŸŒน' | '๐Ÿ˜ฝ' | 'โฃ๏ธ' | 'โค๏ธ';
2
- type HappyEmojis = '๐Ÿ˜€' | '๐Ÿ˜ƒ' | '๐Ÿ˜„' | '๐Ÿ˜' | '๐Ÿ˜†' | '๐Ÿ˜…' | '๐Ÿ˜‚' | '๐Ÿคฃ' | '๐Ÿ™‚' | '๐Ÿ˜›' | '๐Ÿ˜' | '๐Ÿ˜œ' | '๐Ÿคช' | '๐Ÿค—' | '๐Ÿ˜บ' | '๐Ÿ˜ธ' | '๐Ÿ˜น' | 'โ˜บ' | '๐Ÿ˜Œ' | '๐Ÿ˜‰' | '๐Ÿค—' | '๐Ÿ˜Š';
3
- type SadEmojis = 'โ˜น' | '๐Ÿ˜ฃ' | '๐Ÿ˜–' | '๐Ÿ˜ซ' | '๐Ÿ˜ฉ' | '๐Ÿ˜ข' | '๐Ÿ˜ญ' | '๐Ÿ˜ž' | '๐Ÿ˜”' | '๐Ÿ˜Ÿ' | '๐Ÿ˜•' | '๐Ÿ˜ค' | '๐Ÿ˜ ' | '๐Ÿ˜ฅ' | '๐Ÿ˜ฐ' | '๐Ÿ˜จ' | '๐Ÿ˜ฟ' | '๐Ÿ˜พ' | '๐Ÿ˜“' | '๐Ÿ™โ€โ™‚๏ธ' | '๐Ÿ™โ€โ™€๏ธ' | '๐Ÿ’”' | '๐Ÿ™' | '๐Ÿฅบ' | '๐Ÿค•' | 'โ˜”๏ธ' | 'โ›ˆ' | '๐ŸŒฉ' | '๐ŸŒง';
4
- type AngryEmojis = '๐Ÿ˜ฏ' | '๐Ÿ˜ฆ' | '๐Ÿ˜ง' | '๐Ÿ˜ฎ' | '๐Ÿ˜ฒ' | '๐Ÿ™€' | '๐Ÿ˜ฑ' | '๐Ÿคฏ' | '๐Ÿ˜ณ' | 'โ—' | 'โ•' | '๐Ÿคฌ' | '๐Ÿ˜ก' | '๐Ÿ˜ ' | '๐Ÿ™„' | '๐Ÿ‘ฟ' | '๐Ÿ˜พ' | '๐Ÿ˜ค' | '๐Ÿ’ข' | '๐Ÿ‘บ' | '๐Ÿ—ฏ๏ธ' | '๐Ÿ˜’' | '๐Ÿฅต';
5
- type GreetEmojis = '๐Ÿ‘‹';
6
- type CelebrateEmojis = '๐ŸŽŠ' | '๐ŸŽ‰' | '๐ŸŽ' | '๐ŸŽˆ' | '๐Ÿ‘ฏโ€โ™‚๏ธ' | '๐Ÿ‘ฏ' | '๐Ÿ‘ฏโ€โ™€๏ธ' | '๐Ÿ’ƒ' | '๐Ÿ•บ' | '๐Ÿ”ฅ' | 'โญ๏ธ' | 'โœจ' | '๐Ÿ’ซ' | '๐ŸŽ‡' | '๐ŸŽ†' | '๐Ÿป' | '๐Ÿฅ‚' | '๐Ÿพ' | '๐ŸŽ‚' | '๐Ÿฐ';
7
- export type category = LoveEmojis | HappyEmojis | SadEmojis | AngryEmojis | GreetEmojis | CelebrateEmojis;
8
- export {};
@@ -1,10 +0,0 @@
1
- import { category } from './categoryType.js';
2
- import { StickerTypes } from './StickerTypes.js';
3
- export interface MetaDataType {
4
- pack?: string;
5
- author?: string;
6
- id?: string;
7
- category?: category[];
8
- type?: StickerTypes;
9
- quality?: number;
10
- }