UNPKG
descartes.js
Version:
latest (0.1.0)
0.1.0
0.0.2
0.0.1
A JS alternative to matplotlib, made for Descartes
github.com/arguiot/Descartes
arguiot/Descartes
descartes.js
/
src
/
includes
/
functions
/
savefig.js
9 lines
(8 loc)
•
231 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
savefig
(
path
) {
const
ext =
require
(
'path'
).
extname
(path).
split
(
"."
)[
1
]
if
(
this
.
ext
!= ext) {
throw
"Extension names doesn't match."
}
const
buf =
this
.
canvas
.
toBuffer
(); fs.
writeFileSync
(path, buf); }