
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@macfja/serializer
Advanced tools
Transform any object, class, array, primitive to a serialized string and vice-versa
Transform any object, class, array, primitive to a serialized string and vice-versa
npm install @macfja/serializer
# or
yarn add @macfja/serializer
# or
pnpm add @macfja/serializer
import { serialize, deserialize } from "@macfja/serializer";
const serialized = serialize({ any: "data", you: "want" });
// serialized is a string
const myData = deserialize(serialized);
// myData is now `{any: 'data', you: 'want'}`
import {
serialize,
deserialize,
addGlobalAllowedClass,
} from "@macfja/serializer";
function MyClass(data) {
this.data = data;
}
MyClass.prototype.getData = function () {
return this.data;
};
addGlobalAllowedClass(MyClass);
let myInstance = new MyData("john");
const serialized = serialize(myInstance);
// serialized is a string
const myData = deserialize(serialized);
console.log(myData.getData()); // "john"
import { serialize, getCollectedClasses } from "@macfja/serializer";
const serialized = serialize(myComplexData);
// serialized is a string
const usedClasses = getCollectedClasses(true);
// usedClasses contains the list of classes found during the serialization
import { addClassHandler } from "@macfja/serializer";
function MyClass() {
this.name = "doe";
}
MyClass.prototype.setName = function (name) {
this.name = name;
};
MyClass.prototype.getName = function () {
return this.name;
};
addClassHandler(
"MyClass",
(data) => ({ name: data.getName() }),
(plain) => {
const value = new MyClass();
value.setName(plain.name);
return value;
}
);
// Now `serialize` and `deserialize` will use your custom serializer / deserializer
// for any instance of `MyClass`
Date
, BigInt
, String
, RegExp
, Number
, Map
, Set
, ArrayBuffer
, DataView
, Error
, EvalError
, RangeError
, AggregateError
, ReferenceError
, SyntaxError
, TypeError
, URIError
, Int8Array
, Uint8Array
, Uint8ClampedArray
, Int16Array
, Uint16Array
, Int32Array
, Uint32Array
, Float32Array
, Float64Array
, BigInt64Array
, BigUint64Array
)Contributions are welcome. Please open up an issue or create PR if you would like to help out.
Read more in the Contributing file
The MIT License (MIT). Please see License File for more information.
[1.1.4]
global
/globalThis
FAQs
Transform any object, class, array, primitive to a serialized string and vice-versa
The npm package @macfja/serializer receives a total of 803 weekly downloads. As such, @macfja/serializer popularity was classified as not popular.
We found that @macfja/serializer 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.