New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tinify

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinify - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0

lib/tinify/cacert.d.ts

8

lib/tinify.d.ts

@@ -19,6 +19,6 @@ import { Callback } from "./tinify/compat";

ConnectionError: typeof ConnectionError;
key: string;
appIdentifier: string;
proxy: string;
readonly client: Client;
set key(key: string);
set appIdentifier(appIdentifier: string);
set proxy(proxy: string);
get client(): Client;
fromFile(path: string): Source;

@@ -25,0 +25,0 @@ fromBuffer(data: string | Uint8Array): Source;

@@ -46,3 +46,3 @@ "use strict";

const request = this.client.request("post", "/shrink");
return compat_1.nodeify(request.catch(err => {
return (0, compat_1.nodeify)(request.catch(err => {
if (err instanceof Error_1.ClientError || is429(err))

@@ -54,3 +54,3 @@ return;

catch (err) {
return compat_1.nodeify(Promise.reject(err), callback);
return (0, compat_1.nodeify)(Promise.reject(err), callback);
}

@@ -57,0 +57,0 @@ }

@@ -5,8 +5,6 @@ "use strict";

const url = require("url");
const fs = require("fs");
const proxyAgent = require("proxying-agent");
const https_proxy_agent_1 = require("https-proxy-agent");
const package_json_1 = require("../../package.json");
const tinify_1 = require("../tinify");
const boundaries = /-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----\n/g;
const data = fs.readFileSync(`${__dirname}/../data/cacert.pem`).toString();
const cacert_1 = require("./cacert");
class Client {

@@ -29,6 +27,5 @@ /** @internal */

seems to be no proxy tunneling agent that reuses TLS connections. */
this.defaultOptions.agent = proxyAgent.create({
proxy,
keepAlive: true,
}, klass.API_ENDPOINT);
this.defaultOptions.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy, {
"keepAlive": true,
});
}

@@ -113,3 +110,3 @@ }

/** @internal */
Client.CA_BUNDLE = data.match(boundaries);
Client.CA_BUNDLE = cacert_1.CA_CERTS;
exports.default = Client;

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

export declare type Callback<T = void> = (err: Error | null, data?: T) => void;
export type Callback<T = void> = (err: Error | null, data?: T) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nodeify = exports.writeFile = exports.readFile = void 0;
const fs = require("fs");

@@ -4,0 +5,0 @@ /** @internal */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectionError = exports.ServerError = exports.ClientError = exports.AccountError = exports.Error = void 0;
class Error extends global.Error {

@@ -4,0 +5,0 @@ /** @internal */

@@ -11,7 +11,7 @@ import { Callback } from "./compat";

mediaType(): Promise<string | void>;
mediaType(callback: Callback<string>): void;
mediaType(callback: Callback<string | void>): void;
contentType(): Promise<string | void>;
contentType(callback: Callback<string>): void;
contentType(callback: Callback<string | void>): void;
extension(): Promise<string | void>;
extension(callback: Callback<string>): void;
extension(callback: Callback<string | void>): void;
}

@@ -16,3 +16,3 @@ "use strict";

/* Ignore errors on data, because they'll be propagated to meta too. */
return this._data.catch(ignore) && this._meta;
return this._data.catch(ignore).then(() => this._meta);
}

@@ -22,16 +22,16 @@ /** @internal */

/* Ignore errors on meta, because they'll be propagated to data too. */
return this._meta.catch(ignore) && this._data;
return this._meta.catch(ignore).then(() => this._data);
}
toFile(path, callback) {
const writer = compat_1.writeFile.bind(null, path);
return compat_1.nodeify(this.data().then(writer), callback);
return (0, compat_1.nodeify)(this.data().then(writer), callback);
}
toBuffer(callback) {
return compat_1.nodeify(this.data(), callback);
return (0, compat_1.nodeify)(this.data(), callback);
}
size(callback) {
return compat_1.nodeify(this.meta().then(meta => intify(meta["content-length"])), callback);
return (0, compat_1.nodeify)(this.meta().then(meta => intify(meta["content-length"])), callback);
}
mediaType(callback) {
return compat_1.nodeify(this.meta().then(meta => meta["content-type"]), callback);
return (0, compat_1.nodeify)(this.meta().then(meta => meta["content-type"]), callback);
}

@@ -42,5 +42,5 @@ contentType(callback) {

extension(callback) {
return compat_1.nodeify(this.meta().then(meta => (meta["content-type"] || " ").split("/")[1]), callback);
return (0, compat_1.nodeify)(this.meta().then(meta => (meta["content-type"] || " ").split("/")[1]), callback);
}
}
exports.default = Result;

@@ -7,4 +7,4 @@ import { Callback } from "./compat";

height(callback: Callback<number>): void;
location(): Promise<string | void>;
location(): Promise<string>;
location(callback: Callback<string>): void;
}

@@ -15,11 +15,11 @@ "use strict";

width(callback) {
return compat_1.nodeify(this.meta().then(meta => intify(meta["image-width"])), callback);
return (0, compat_1.nodeify)(this.meta().then(meta => intify(meta["image-width"])), callback);
}
height(callback) {
return compat_1.nodeify(this.meta().then(meta => intify(meta["image-height"])), callback);
return (0, compat_1.nodeify)(this.meta().then(meta => intify(meta["image-height"])), callback);
}
location(callback) {
return compat_1.nodeify(this.meta().then(meta => meta["location"]), callback);
return (0, compat_1.nodeify)(this.meta().then(meta => meta["location"]), callback);
}
}
exports.default = ResultMeta;
import { Callback } from "./compat";
import Result from "./Result";
import ResultMeta from "./ResultMeta";
export type SupportedImageTypes = "image/webp" | "image/png" | "image/jpg" | "image/jpeg" | "image/avif";
export type WildcardOrSupportedImageTypes = SupportedImageTypes | "*/*";
export type ConvertOptions = {
type: WildcardOrSupportedImageTypes | SupportedImageTypes[];
};
export default class Source {

@@ -17,4 +22,4 @@ static fromFile(path: string): Source;

toBuffer(callback: Callback<Uint8Array>): void;
convert(options: object): Source;
convert(options: ConvertOptions): Source;
transform(options: object): Source;
}

@@ -12,3 +12,3 @@ "use strict";

static fromFile(path) {
const location = compat_1.readFile(path).then(data => {
const location = (0, compat_1.readFile)(path).then(data => {
const response = tinify_1.default.client.request("post", "/shrink", data);

@@ -15,0 +15,0 @@ return response.then(res => res.headers.location);

{
"name": "tinify",
"version": "1.7.1",
"version": "1.8.0",
"description": "Node.js client for the Tinify API. Tinify compresses your images intelligently. Read more at https://tinify.com.",

@@ -21,3 +21,5 @@ "keywords": [

},
"files": ["lib"],
"files": [
"lib"
],
"bugs:": "https://github.com/tinify/tinify-nodejs/issues",

@@ -34,7 +36,7 @@ "scripts": {

"dependencies": {
"promise-nodeify": ">= 0.1",
"proxying-agent": ">= 2.1"
"https-proxy-agent": "^7.0.6",
"promise-nodeify": ">= 0.1"
},
"devDependencies": {
"@types/node": "~10.3.1",
"@types/node": "22.13.4",
"chai": "^2.3.0",

@@ -46,4 +48,4 @@ "mocha": "^2.2.5",

"tslint": "^5.10.0",
"typescript": "^2.9.2"
"typescript": "^5.7.3"
}
}

@@ -52,4 +52,11 @@ [<img src="https://travis-ci.org/tinify/tinify-nodejs.svg?branch=master" alt="Build Status">](https://travis-ci.org/tinify/tinify-nodejs)

#### To test with proxy:
$ docker run --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 8080:8080 mitmproxy/mitmproxy mitmproxy --listen-host 0.0.0.0
$ TINIFY_PROXY=http://172.17.0.3:8080 npm run integration
## License
This software is licensed under the MIT License. [View the license](LICENSE).
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