Skip to content

Commit

Permalink
Merge pull request #7 from gatewayapps/6/parse-buffer
Browse files Browse the repository at this point in the history
parseBuffer method(#6)
  • Loading branch information
johnmurphy01 authored Sep 10, 2018
2 parents 1b1e263 + 87e7ec7 commit 5e77719
Show file tree
Hide file tree
Showing 5 changed files with 3,970 additions and 9 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ The TNEF parser will enumerate every file in the directory. If the file does not
# How to use within a NodeJS project
Just require in `node-tnef` into a NodeJS project. The `node-tnef` library currently has a `parse` method that:
- takes a path to a TNEF formatted file
- a callback function which returns an error object and an object containing all attachments within the provided file(or null if none)
- a callback function which returns a Buffer containing the decoded TNEF content

The format of the content object returned is an Array Object. Can be null
There is also a `parseBuffer` method that:
- takes a Buffer representation of the TNEF file
- a callback function which returns a Buffer containing the decoded TNEF content

Object Properties:
- Title - The attachment's title(including file extension)
- Data - The attachment data. Can be used to write to a file using `fs` or another mechanism. Create a new Buffer passing in Data.

Example:
Examples:
```
var tnef = require('node-tnef')
var fs = require('fs')
Expand All @@ -53,6 +55,11 @@ tnef.parse('/path/to/the/tnef/file', function (err, content) {
})
...
})
tnef.parseBuffer([your buffer of data], function (err, content) {
// content would contain the result data as a Buffer
// from here you can write to a file, evaluate the contents(ex. content.Attachments or content.Body)
})
```

# Issues/Feedback?
Expand Down
Loading

0 comments on commit 5e77719

Please sign in to comment.