--- /dev/null
+var B = require('../').Buffer
+var test = require('tape')
+
+var data = [
+ '',
+ ''
+]
+
+test('base64 strings with newlines / invalid charaters', function (t) {
+ // newline in utf8 -- should not be an issue
+ t.equal(
+ new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK', 'base64').toString('utf8'),
+ '---\ntitle: Three dashes marks the spot\ntags:\n'
+ )
+
+ // newline in base64 -- should get stripped
+ t.equal(
+ new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\nICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),
+ '---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'
+ )
+
+ // tab characters in base64 - should get stripped
+ t.equal(
+ new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\t\t\t\tICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),
+ '---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'
+ )
+ t.end()
+})