文件操作 - raster-to-svg.js
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/svg-baker/lib/transformations/raster-to-svg.js
编辑文件内容
const getImageSize = require('image-size'); const { svg, xlink } = require('../../namespaces'); /** * TODO rasterToSVG#getPixelRatioFromFilename * @param {Buffer} buffer * @return {string} */ function rasterToSVG(buffer) { const info = getImageSize(buffer); const { width, height, type } = info; const defaultNS = `${svg.name}="${svg.uri}"`; const xlinkNS = `${xlink.name}="${xlink.uri}"`; const data = `data:image/${type};base64,${buffer.toString('base64')}`; return [ `<svg ${defaultNS} ${xlinkNS} width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">`, `<image xlink:href="${data}" width="${width}" height="${height}" />`, '</svg>' ].join(''); } module.exports = rasterToSVG;
修改文件时间
将文件时间修改为当前时间的前一年
删除文件