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

captcha-generator-alphanumeric

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

captcha-generator-alphanumeric - npm Package Compare versions

Comparing version 1.10.1 to 1.10.2

0

dist/index.d.ts

@@ -0,0 +0,0 @@ import * as Canvas from "canvas";

@@ -0,0 +0,0 @@ "use strict";

19

examples/writeToFiles.js
// Import the module
const Captcha = require("../").default;
const { promisify } = require("util");

@@ -7,3 +8,3 @@ const path = require("path"),

fs.readdir(__dirname, (err, files) => {
fs.readdir(__dirname, async (err, files) => {
if (err) throw err;

@@ -13,12 +14,10 @@

if (file.endsWith('.jpeg'))
fs.unlink(path.join(__dirname, file), err => {
if (err) throw err;
});
await promisify(fs.unlink)(path.join(__dirname, file));
}
});
for (let i = 0; i < 10; i++) {
let captcha = new Captcha();
console.log(captcha.value);
captcha.JPEGStream.pipe(fs.createWriteStream(path.join(__dirname, `${captcha.value}.jpeg`)));
}
for (let i = 0; i < 10; i++) {
let captcha = new Captcha();
console.log(captcha.value);
captcha.JPEGStream.pipe(fs.createWriteStream(path.join(__dirname, `${captcha.value}.jpeg`)));
}
});
{
"name": "captcha-generator-alphanumeric",
"version": "1.10.1",
"version": "1.10.2",
"description": "An NPM package to generate alphanumeric captcha images",

@@ -20,8 +20,8 @@ "main": "dist/index.js",

"dependencies": {
"canvas": "^2.11.0"
"canvas": "^2.11.2"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/mocha": "^10.0.1",
"@types/node": "^18.13.0",
"@types/mocha": "^10.0.6",
"@types/node": "^20.10.2",
"mocha": "^10.2.0",

@@ -32,3 +32,3 @@ "mocha-lcov-reporter": "^1.3.0",

"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"typescript": "^5.3.2"
},

@@ -35,0 +35,0 @@ "engines": {

"use strict";
const assert = require("assert");
const Canvas = require("canvas");
const Captcha = require("../");
const Captcha = require("../").default;
const fs = require("fs");
const path = require("path");

@@ -25,5 +27,2 @@ describe("src/index.ts", function () {

});
it("should only contain letters", function () {
assert.match(captcha.value, /^[a-z]+$/i);
});
});

@@ -52,18 +51,17 @@

const fs = require("fs");
const path = require("path");
require("../examples/writeToFiles");
describe("examples/writeToFiles.js", function () {
const files = fs
.readdirSync(path.join(__dirname, "..", "examples"))
.filter(f => ["png", "jpeg"].includes(f.split(".")[1]));
it("should create a new PNG file", function () {
assert.strictEqual(Boolean(files.filter(f => f.endsWith(".png")).length), true);
describe("file creation", function () {
before(function (done) {
require("../examples/writeToFiles");
this.timeout(5000);
setTimeout(done, 2000);
});
it("should create a new JPEG file", function () {
const files = fs
.readdirSync(path.join(__dirname, "..", "examples"))
.filter(f => ["png", "jpeg"].includes(f.split(".")[1]));
assert.strictEqual(Boolean(files.filter(f => f.endsWith(".jpeg")).length), true);
});
for (const file of files) {
fs.unlinkSync(path.join(__dirname, "..", "examples", file));
}
});

Sorry, the diff of this file is not supported yet

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