Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A nodejs client for generating data using the rest api from http://mockaroo.com
npm install mockaroo
http://mockaroo.com/api/node/index.html
The mockaroo client's generate method returns a promise that resolves to an array of records.
You can either generate data using a schema that you've built and saved on mockaroo.com:
var Mockaroo = require('mockaroo');
var client = new Mockaroo.Client({
apiKey: 'e93db400' // see http://mockaroo.com/api/docs to get your api key
})
client.generate({
count: 10,
schema: 'My Saved Schema'
}).then(function(records) {
...
});
Or you can specify fields using the API:
client.generate({
count: 10,
fields: [{
name: 'id',
type: 'Row Number'
}, {
name: 'transactionType',
type: 'Custom List',
values: ['credit', 'debit']
}]
}).then(function(records) {
// handle response
});
Field types and parameters are documented here
You can also download data in csv format:
client.generate({
count: 10,
format: 'csv',
header: true, // this is the default, set to false to remove the header row
fields: [...]
}).then(function(records) {
// handle response
});
The Promise returned by client.generate resolves to an array of records when count > 1 and a single object when count == 1. The keys are the names of the fields in your schema. For example:
client.generate({
count: 10,
fields: [{
name: 'id',
type: 'Row Number'
}, {
name: 'transactionType',
type: 'Custom List',
values: ['credit', 'debit']
}]
}).then(function(records) {
for (var i=0; i<records.length; i++) {
var record = records[i];
console.log('record ' + i, 'id:' + record.id + ', transactionType:' + record.transactionType);
}
});
This module contains Error classes to help you handle specific error conditions.
client.generate({
count: 10,
schema: 'My Saved Schema'
}).then(function(records) {
// handle successful response here
}).catch(function(error) {
if (error instanceof Mockaroo.errors.InvalidApiKeyError) {
console.log('invalid api key');
} else if (error instanceof Mockaroo.errors.UsageLimitExceededError) {
console.log('usage limit exceeded');
} else {
console.log('unknown error', error);
}
});
To generate documentation and compile the es6 code to js, use the default gulp task:
gulp
This module uses mocha and chai for testing. To run tests:
npm test
FAQs
Generate data using the mockaroo.com API
The npm package mockaroo receives a total of 308 weekly downloads. As such, mockaroo popularity was classified as not popular.
We found that mockaroo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.