New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wazza

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

wazza - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

3

package.json
{
"name": "wazza",
"version": "1.0.4",
"version": "1.0.5",
"description": "Parses whatsapp backup txt file to json or csv formats",

@@ -29,2 +29,3 @@ "main": "src/index.js",

"@oclif/plugin-help": "^2.2.0",
"cli-ux": "^5.3.0",
"extract-emoji": "^1.0.2",

@@ -31,0 +32,0 @@ "json2csv": "^4.5.1",

# Wazza
Wazza is a utility to parse whatsapp backup files to csv or json file formats.
It supports csv and json file formats.
** only tested for group backups **
Wazza is a utility to parse one or multiple whatsapp backup files into csv or json file formats. **only tested for group backups**
## Features:
- √ group chat exports
- ? one to one chat exports
- √ csv and json file formats
- √ individual .txt files
- √ directories of .txt (files are combined into one csv or json export)
## How to export Whatsapp group conversations.

@@ -28,2 +34,20 @@

If you have a folder with multiple exports from different channels,
but you want to combine them into one single csv or json file, you can
pass a folder as an argument instead of a file.
Just make sure all files have `.txt` extension.
Example, given you have a folder called `exports/` than contains one or more `.txt` files.
```
wazza exports/ > export.csv
```
or
```
wazza -f json exports/ > export.json
```
and the export file will contain the combination of all exported .txt files.
## Options

@@ -30,0 +54,0 @@

#!/usr/bin/env node
const { Command, flags } = require("@oclif/command");
const { CLIError } = require("@oclif/errors");
const readFile = require("./lib/readFile");
const toCSV = require("./lib/toCSV");
const { Command, flags } = require("@oclif/command");
const { CLIError } = require("@oclif/errors");
const utils = require("./lib/utils");
const { cli } = require("cli-ux");

@@ -11,2 +13,40 @@ class WazzaCommand extends Command {

const { flags, args } = this.parse(WazzaCommand);
if (utils.isDirectory(args.input)) {
const confirmation = await cli.confirm(
`${
args.input
} is a directory, wazza will aggregate all txt files into one ${
flags.format
} file, continue ?`
);
if (confirmation) {
const files = utils.getDirFiles(args.input);
let header = true;
if (flags.format === "json") {
const datas = [];
await Promise.all(
files.map(async file => {
const data = await readFile(args.input + file, flags.date || "");
datas.push(data);
})
);
console.log(JSON.stringify(Array.prototype.concat.apply([], datas)));
process.exit(0);
} else if (flags.format === "csv") {
await Promise.all(
files.map(async file => {
const data = await readFile(args.input + file, flags.date || "");
console.log(toCSV(data, header));
if (header) {
header = false;
}
})
);
process.exit(0);
}
} else {
process.exit(0);
}
}
const data = await readFile(args.input, flags.date || "");

@@ -23,7 +63,15 @@

WazzaCommand.description = `Wazza is a whatsapp backup parser
Features:
- √ group chat exports
- ? one to one chat exports
- √ csv and json file formats
- √ individual .txt files
- √ directories of .txt (files are combined into one csv or json export)
It supports csv and json file formats
- Example, exporting to csv:
wazza _chat.txt > export.csv
- Example, exporting a folder that contains several .txt exported files:
wazza ./exports/ > export.csv
- Example exporting to json:

@@ -30,0 +78,0 @@ wazza -f json _chat.txt > export.json

const { parse } = require("json2csv");
const toCSV = content => {
const toCSV = (content, header = true) => {
const fields = [

@@ -5,0 +5,0 @@ "platform",

@@ -0,1 +1,5 @@

const fs = require("fs");
const path = require("path");
const { CLIError } = require("@oclif/errors");
module.exports = {

@@ -17,3 +21,16 @@ extractNumber: line => {

}
},
isDirectory: path => fs.lstatSync(path).isDirectory(),
getDirFiles: directoryPath => {
try {
const files = fs.readdirSync(directoryPath);
const textFiles = [];
files.forEach(function(file) {
if (path.extname(file) === ".txt") textFiles.push(file);
});
return textFiles;
} catch (err) {
throw new CLIError(`Unable to scan directory ${directoryPath}`);
}
}
};
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