Nodejs file path to url path

2021-03-03 14:26

阅读:698

标签:code   lang   const   ons   lan   from   ges   class   jpg   

import * as path from ‘path‘;
import * as url from ‘url‘;

const savePath = path.join(‘public‘, ‘images‘, ‘a.jpg‘); 
// => \public\images\a.jpg

const urlPath = url.parse(savePath).path; 
// => /public/images/a.jpg

Nodejs file path to url path

标签:code   lang   const   ons   lan   from   ges   class   jpg   

原文地址:https://www.cnblogs.com/ajanuw/p/14254432.html


评论


亲,登录后才可以留言!