Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dreygur/messenger-group-avatar

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dreygur/messenger-group-avatar - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

8

lib/cjs/index.d.ts

@@ -1,1 +0,7 @@

export {};
export interface ResizeType {
width?: number;
height?: number;
out?: string;
inImage?: string;
}
export default function makeCombined(...images: string[]): Promise<string>;

39

lib/cjs/index.js

@@ -38,14 +38,18 @@ "use strict";

};
var sharp = require("sharp");
var fs = require("fs");
var path = require("path");
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var sharp_1 = __importDefault(require("sharp"));
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
function resizeImage(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.width, width = _c === void 0 ? 450 : _c, _d = _b.height, height = _d === void 0 ? 450 : _d, _e = _b.out, out = _e === void 0 ? '' : _e, _f = _b.inImage, inImage = _f === void 0 ? '' : _f;
var _b = _a.width, width = _b === void 0 ? 450 : _b, _c = _a.height, height = _c === void 0 ? 450 : _c, _d = _a.out, out = _d === void 0 ? '' : _d, _e = _a.inImage, inImage = _e === void 0 ? '' : _e;
return __awaiter(this, void 0, void 0, function () {
var error_1;
return __generator(this, function (_g) {
switch (_g.label) {
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
_g.trys.push([0, 2, , 3]);
return [4 /*yield*/, sharp(inImage)
_f.trys.push([0, 2, , 3]);
return [4 /*yield*/, (0, sharp_1.default)(inImage)
.resize({

@@ -63,6 +67,6 @@ width: width,

case 1:
_g.sent();
_f.sent();
return [3 /*break*/, 3];
case 2:
error_1 = _g.sent();
error_1 = _f.sent();
console.log(error_1);

@@ -88,9 +92,9 @@ return [3 /*break*/, 3];

throw new Error('Must provide at least 3 images');
tempPath = path.join(process.cwd(), 'temp');
tempPath = path_1.default.join(process.cwd(), 'temp');
processed = [];
for (i = 0; i < images.length; i++) {
processed.push(path.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-").concat(i, ".jpeg")));
processed.push(path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-").concat(i, ".jpeg")));
}
if (!fs.existsSync(tempPath))
fs.mkdirSync(tempPath);
if (!fs_1.default.existsSync(tempPath))
fs_1.default.mkdirSync(tempPath);
// Resie the images

@@ -107,4 +111,4 @@ return [4 /*yield*/, resizeImage({ inImage: images[0], out: processed[0] })];

_a.sent();
combined = path.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
return [4 /*yield*/, sharp(processed[0])
combined = path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([

@@ -134,3 +138,2 @@ {

}
makeCombined(path.join(process.cwd(), 'pp.jpeg'), path.join(process.cwd(), 'pp.jpeg'), path.join(process.cwd(), 'pp.jpeg'))
.then(function (res) { return console.log(res); });
exports.default = makeCombined;

@@ -1,1 +0,7 @@

export {};
export interface ResizeType {
width?: number;
height?: number;
out?: string;
inImage?: string;
}
export default function makeCombined(...images: string[]): Promise<string>;

@@ -38,14 +38,18 @@ "use strict";

};
var sharp = require("sharp");
var fs = require("fs");
var path = require("path");
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var sharp_1 = __importDefault(require("sharp"));
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
function resizeImage(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.width, width = _c === void 0 ? 450 : _c, _d = _b.height, height = _d === void 0 ? 450 : _d, _e = _b.out, out = _e === void 0 ? '' : _e, _f = _b.inImage, inImage = _f === void 0 ? '' : _f;
var _b = _a.width, width = _b === void 0 ? 450 : _b, _c = _a.height, height = _c === void 0 ? 450 : _c, _d = _a.out, out = _d === void 0 ? '' : _d, _e = _a.inImage, inImage = _e === void 0 ? '' : _e;
return __awaiter(this, void 0, void 0, function () {
var error_1;
return __generator(this, function (_g) {
switch (_g.label) {
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
_g.trys.push([0, 2, , 3]);
return [4 /*yield*/, sharp(inImage)
_f.trys.push([0, 2, , 3]);
return [4 /*yield*/, (0, sharp_1.default)(inImage)
.resize({

@@ -63,6 +67,6 @@ width: width,

case 1:
_g.sent();
_f.sent();
return [3 /*break*/, 3];
case 2:
error_1 = _g.sent();
error_1 = _f.sent();
console.log(error_1);

@@ -88,9 +92,9 @@ return [3 /*break*/, 3];

throw new Error('Must provide at least 3 images');
tempPath = path.join(process.cwd(), 'temp');
tempPath = path_1.default.join(process.cwd(), 'temp');
processed = [];
for (i = 0; i < images.length; i++) {
processed.push(path.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-").concat(i, ".jpeg")));
processed.push(path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-").concat(i, ".jpeg")));
}
if (!fs.existsSync(tempPath))
fs.mkdirSync(tempPath);
if (!fs_1.default.existsSync(tempPath))
fs_1.default.mkdirSync(tempPath);
// Resie the images

@@ -107,4 +111,4 @@ return [4 /*yield*/, resizeImage({ inImage: images[0], out: processed[0] })];

_a.sent();
combined = path.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
return [4 /*yield*/, sharp(processed[0])
combined = path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([

@@ -134,3 +138,2 @@ {

}
makeCombined(path.join(process.cwd(), 'pp.jpeg'), path.join(process.cwd(), 'pp.jpeg'), path.join(process.cwd(), 'pp.jpeg'))
.then(function (res) { return console.log(res); });
exports.default = makeCombined;
{
"name": "@dreygur/messenger-group-avatar",
"description": "Avatar generator that looks like messenger group chat default avatar",
"version": "0.0.2",
"version": "0.0.3",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "./lib/cjs/index.js",

@@ -5,2 +5,4 @@ # Avatar generator that looks like messenger group chat default avatar

## TS/ES
```typescript

@@ -10,3 +12,12 @@ import makeCombined from '@dreygur/messenger-group-avatar';

makeCombined(...images)
.then((combinedImage) => // do whatever you want to do with the combined image);
```
.then((combinedImage) => /* do whatever you want to do with the combined image */ );
```
## CommonJS/Node.js
```js
const { default: makeCombined } = require('@dreygur/messenger-group-avatar');
makeCombined(...images)
.then((combinedImage) => /* do whatever you want to do with the combined image */ );
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc