例えば、http://www.piyo.com/foo/bar/hoge.pngのようなurlからhoge.png
を取得したいとき
sample.js
var url = require('url');
var link = 'http://www.hoge.hoge/foo/bar/hoge.png';
var file = url.parse(link).pathname.split('/').pop();
// hoge.png
Go to list of users who liked
More than 5 years have passed since last update.
例えば、http://www.piyo.com/foo/bar/hoge.pngのようなurlからhoge.png
を取得したいとき
var url = require('url');
var link = 'http://www.hoge.hoge/foo/bar/hoge.png';
var file = url.parse(link).pathname.split('/').pop();
// hoge.png
Register as a new user and use Qiita more conveniently
Go to list of users who liked