Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

feat: add encoding option (options.encoding) #79

Closed
wants to merge 1 commit into from

Conversation

michael-ciniawsky
Copy link
Member

No description provided.

// No limits or limit more than content length
if(!limit || content.length < limit) {
if(typeof content === "string") {
content = new Buffer(content);
}

return "module.exports = " + JSON.stringify("data:" + (mimetype ? mimetype + ";" : "") + "base64," + content.toString("base64"));
return "module.exports = " + JSON.stringify("data:" + (mimetype ? mimetype + ";" : "") + options.encoding + "," + content.toString(options.encoding));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"data:<mimetype>;<encoding>,<content...>"

return "module.exports = " + JSON.stringify("data:" 
 + (mimetype ? mimetype + ";" : "") 
 + (options.encoding  ? options.encoding : (?*) )  + "," 
 + content.toString(options.encoding ? options.encoding : (?*) ));

?* => Discuss/Triage

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky

return "module.exports = " + JSON.stringify("data:" + (mimetype ? mimetype + ";" : "") + encoding + "," + content.toString(encoding)

@michael-ciniawsky
Copy link
Member Author

Reference #28

@michael-ciniawsky
Copy link
Member Author

Fixes #25 #28

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky let's complete this PR

// No limits or limit more than content length
if(!limit || content.length < limit) {
if(typeof content === "string") {
content = new Buffer(content);
}

return "module.exports = " + JSON.stringify("data:" + (mimetype ? mimetype + ";" : "") + "base64," + content.toString("base64"));
return "module.exports = " + JSON.stringify("data:" + (mimetype ? mimetype + ";" : "") + options.encoding + "," + content.toString(options.encoding));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky

return "module.exports = " + JSON.stringify("data:" + (mimetype ? mimetype + ";" : "") + encoding + "," + content.toString(encoding)

@michael-ciniawsky michael-ciniawsky changed the title (WIP) feat: add encoding option (options.encoding) (WIP) feat: add encoding option (options.encoding) Sep 13, 2017
@michael-ciniawsky
Copy link
Member Author

@evilebottnawi 👍 But I need to revisit this first and please take a look at #28 in conjunction aswell, when time :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants