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.
AppData is a minimalistic Node.js framework for accessing, writing and manipulating datasets in the users AppData (or Homedata) folder. It has a simple API and helps you saving persistent data for e.g. an electron desktop application.
AppData is a minimalistic Node.js framework for accessing, writing and manipulating datasets in the users AppData (or Homedata) folder. It has a simple API and helps you saving persistent data for e.g. an electron desktop application.
npm install --save appdata
# or via git
git clone https://github.com/janbiasi/appdata.git
First off you need to create a new AppData Storage object. The AppData module exports a function which takes one argument, an optional custom settings object. If you are wondering which options are supported, take a look at TODO.
const appdata = require('appdata');
Next, you will have to select your database by a name. If the database does not exists a new set will be created by the system itself. There are only lower-, uppercase letters, numbers, hyphens and underscores allowed!
const database = appdata.connect('database-name', {
/* options here */
});
connect(name: String [, options: Object]): Interface
Inserting data is as simple as setting new variables! The key must be a string and not an integer. But the value can be whatever you'd like to insert.
database.set('hello', 'world!');
database.set('mynum', 1923);
database.set('coll', [ 0, undefined, 'hey' ]);
set(key: String, value: <T>): <T>
Like inserting, reading is very simple. Grab the key you'd like to find the value for and you'll get the result (or undefined in case the key does not exist).
database.all(); // { hello: "world!" ... }
database.get('hello'); // world!
database.get('mynum'); // 1923
get(key: String): <T>
Datasets can be deleted by key or can be totally removed by the .drop()
method. The methods are pretty simple to use, just look at the example below.
let name = storage.delete('name');
storage.get('name') === name; // false
storage.drop(); // {}
drop(): <T>
The Interface inherits from the EventEmitter
class, so it implements
its own events. All possible events execute on the storage are listed below with
a description and its paramters.
Event | Description | Paramter |
---|---|---|
connect | Emitted when connected to the database | Database-name |
sync | Emitted on sync action | Boolean or data synced |
set | Emitted when setting a new key-value pair | Key and value |
get | Emitted when getting a key-value pair | Key and value |
has | Emitted when checking if a key exists | Key and if exists (Boolean) |
delete | Emitted when deleting a key-value pair | Key and the deleted value |
drop | Emitted when dropping the database | - |
on(event: String, handler: Function): void
Services can be created and published as node modules for adding custom functionallity to the interface of the AppData module. Services can be used e.g. for filtering, querying, exporting data and much more. Inside the service itself there is an interface property, which will provide you all methods which are listed above! Here is a short example how you can create your own service;
var Service = require('appdata').Service;
var MyService = new Service();
MyService.filter = function(data, options) {
var data = this.interface.all();
// ... add your filter logic here
return [];
};
// Attach the service to your store instance
storage.service(MyService);
This project is licensed under the Apache 2.0 License.
FAQs
AppData is a minimalistic Node.js framework for accessing, writing and manipulating datasets in the users AppData (or Homedata) folder. It has a simple API and helps you saving persistent data for e.g. an electron desktop application.
The npm package appdata receives a total of 0 weekly downloads. As such, appdata popularity was classified as not popular.
We found that appdata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.