patorjk / figlet.js

A FIG Driver written in JavaScript which aims to fully implement the FIGfont spec.
MIT License
2.64k stars 170 forks source link

Feature Request: Sync function that returns data instead of logging it to console #20

Closed philkunz closed 8 years ago

philkunz commented 8 years ago

Hi, first of all: awesome node module!

Would it be possible for you to implement a Sync function that simply returns data instead of logging it to console? The Async way is fine, however that requires to work with promises which sometimes is overhead.

Thank you and regards Phil

patorjk commented 8 years ago

What do you mean? There's a textSync function that returns text.

I like the promise idea. The text function probably should return a promise.

philkunz commented 8 years ago

I'm so sorry. I somehow was under the impression that the function doesn't return the text, but logs it to console directly... My bad.

patorjk commented 8 years ago

No worries, I might update the docs to make it a little more clear.

websemantics commented 8 years ago

Hi, love this module, .. I tried this, but it doesn't seem to be supported in the browser, .. one way could be to preload selected fonts so they are available at run-time?

websemantics commented 8 years ago

Create a pull request to fix this issue by providing fonts preload option, https://github.com/patorjk/figlet.js/pull/22

kasir-barati commented 3 years ago

why did not use promise? I like promise syntax more than the textSync function. Thanks for this great package @patorjk

patorjk commented 3 years ago

@nodejsdeveloperskh Returning a promise is something I plan on adding at some point in (probably the near) future. I liked the idea previously, but I didn't want this library having to rely on a polyfill. Promises are are very well supported now though so there's really no reason not to.