-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
debugging.js
67 lines (59 loc) · 2.18 KB
/
debugging.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const MailParser = require("mailparser").MailParser;
const path = require("path");
const fs = require("fs");
const Plaintext = require("./parsers/text");
const _import = function _import() {
const mailparser = new MailParser();
mailparser.on("end", function(mail) {
const plaintext = new Plaintext(mail);
console.log("Parseable: ", plaintext.parseable());
console.log(plaintext.parse(mail));
});
fs.createReadStream(path.resolve("exports/text-email")).pipe(mailparser);
};
_import();
// var _burnItAll = function _burnItAll() {
// getBooks().then(function (books) {
// console.log("Deleting %d books", books.length);
// async.eachSeries(books, function (book, cb) {
// siteleaf.request('documents/' + book.id, { method: 'DELETE' }).then(cb.bind(null, null));
// });
// }).then(getHighlights).then(function (documents) {
// console.log("Deleting %d highlights", documents.length);
// async.eachSeries(documents, function (doc, cb) {
// siteleaf.request('documents/' + doc.id, { method: 'DELETE' }).then(cb.bind(null, null));
// });
// });
// };
// var _massImport = function _massImport() {
// var files = ['exports/readmill-likes-and-kindle-bookmarklet', 'exports/readmill/reading-data-attachment', 'exports/kindle/clippings-email', 'exports/ibooks/email'];
// async.eachSeries(files, function (file, cb) {
// var mailparser = new MailParser();
// mailparser.on("end", function (mail) {
// parse(mail).then(function () {
// return cb();
// });
// });
// fs.createReadStream(path.resolve(file)).pipe(mailparser);
// });
// };
// var _setDates = function _setDates() {
// getBooks().then(function (books) {
// async.eachSeries(books, function (book, cb) {
// console.log("Editing %s", book.title);
// var date = moment().utcOffset('-05:00').format();
// var metadata = merge(book.metadata, {
// date: date
// });
// siteleaf.request('documents/' + book.id, {
// method: 'PUT',
// body: {
// published_at: date,
// metadata: metadata
// }
// }).then(function () {
// return cb();
// });
// });
// });
// };