これが私のコードです:
var thisImageName = thisRow["imagename"];
var thisImagePath = path.relative("./public", __dirname + "/public/uploads/" + thisImageName + ".jpg");
console.log(thisImagePath); // returns __dirname\public\uploads\
img.src = thisImagePath.split(path.sep).join("/");
適切な画像パスを取得するには、パス区切り記号で分割してから、適切なスラッシュで配列を結合する必要があります。これを行うより効率的な方法を知っている人はいますか?