@sgbots/data-anonymiser
v1.0.1
Published
Detects and encrypts/decrypts Personally Identifiable Informationn in .parquet, .csv and .xlsx/.xlsm files
Readme
@sgbots/data-anonymiser
Detects and encrypts/decrypts Personally Identifiable Information (PII) in .parquet, .csv, .xlsx, and .xlsm files.
Features
- Detects PII columns using a FastAPI endpoint.
- Encrypts detected columns with a secret key.
- Decrypts previously encrypted files.
- Converts between supported file formats.
Installation
npm install @sgbots/data-anonymiserUsage
const { encryptFile, decryptFile } = require('@sgbots/data-anonymiser');
(async () => {
// Encrypt PII columns in a file
const result = await encryptFile('path/to/data.xlsx');
console.log('Encrypted columns:', result.colResult);
console.log('Encrypted file:', result.encryptedFilePath);
// Decrypt previously encrypted file
const decrypted = await decryptFile(result.encryptedFilePath);
console.log('Decrypted columns:', decrypted.decryptedColumns);
console.log('Decrypted file:', decrypted.decryptedFilePath);
})();API
encryptFile(filePath)
Detects PII columns and encrypts them.
filePath: Path to.csv,.xlsx,.xlsm, or.parquetfile.- Returns:
{ colResult, encryptedFilePath }
decryptFile(filePath)
Decrypts encrypted columns in a file.
filePath: Path to encrypted file.- Returns:
{ decryptedFilePath, decryptedColumns }
License
ISC
