-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
29 lines (25 loc) · 794 Bytes
/
main.js
File metadata and controls
29 lines (25 loc) · 794 Bytes
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
'use strict';
const { console } = require('./logger.js');
const { Attachment, Message, send, canAttach } = require('./delivery.js');
const main = async () => {
const subj = 'De virtutem animi';
const text = [
'Lucio Verissimo Fratri,',
'Hodie cogitavi de iis quae mihi et tibi sunt communia...',
];
const data = text.join('\n');
const message = new Message('Lucius Verus', subj, data);
const file = new Attachment('./main.js');
await message.attach(file);
try {
await send(message);
} catch (error) {
console.warn(error);
}
const file1 = message.files[0];
const file2 = new Attachment('./logger.js');
const file3 = { filename: './unknown.js' };
const attachable = await canAttach([file1, file2, file3]);
console.log({ attachable });
};
main();