Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yshayy committed Oct 16, 2023
1 parent 453fbed commit 36c100c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/core/src/upload-files/tar.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import util from 'util'
import path from 'path'
import fs from 'fs'
import { platform } from 'os'
import { pack, Headers, Pack } from 'tar-stream'
import { Writable, pipeline } from 'stream'
import { EmitterConsumer } from '@preevy/common'
import { TransferProgressEmitter, TransferProgressEvents, transferProgressEmitter } from './progress'
import { FileInfo, FileToCopy } from './files'
import { Visitor, fsWalker } from './walk'

const isWin = platform() === 'win32'

const headerFromStats = (local: FileInfo, remote: string): Headers | undefined => {
const { stats, symlinkTarget } = local
const header: Headers = {
name: remote,
mode: stats.mode,
mode: isWin ? 0o777 : stats.mode,
mtime: stats.mtime,
size: stats.size,
uid: stats.uid,
Expand Down
4 changes: 2 additions & 2 deletions packages/driver-gce/src/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const googleCloudStorageFs = async (url: string): Promise<VirtualFS> => {
return {
read: async (filename: string) => {
try {
const [result] = await bucket.file(path.join(prefix, filename)).download()
const [result] = await bucket.file(path.posix.join(prefix, filename)).download()
return result
} catch (error) {
if (!hasErrorCode(error, 404)) {
Expand All @@ -63,7 +63,7 @@ export const googleCloudStorageFs = async (url: string): Promise<VirtualFS> => {
},
write: async (filename: string, content: Buffer | string) => await stream.promises.pipeline(
stream.Readable.from(content),
bucket.file(path.join(prefix, filename)).createWriteStream(),
bucket.file(path.posix.join(prefix, filename)).createWriteStream(),
),
delete: async (filename: string) => {
try {
Expand Down
6 changes: 3 additions & 3 deletions packages/driver-lightsail/src/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const s3fs = async (s3Url: string): Promise<VirtualFS> => {
try {
result = await s3.getObject({
Bucket: bucket,
Key: path.join(prefix, filename),
Key: path.posix.join(prefix, filename),
})
} catch (err) {
if (isNotFoundError(err)) {
Expand All @@ -72,15 +72,15 @@ export const s3fs = async (s3Url: string): Promise<VirtualFS> => {
async write(filename: string, content: Buffer | string) {
await s3.putObject({
Bucket: bucket,
Key: path.join(prefix, filename),
Key: path.posix.join(prefix, filename),
Body: content,
})
},
async delete(filename: string) {
try {
await s3.deleteObject({
Bucket: bucket,
Key: path.join(prefix, filename),
Key: path.posix.join(prefix, filename),
})
} catch (err) {
if (isNotFoundError(err)) {
Expand Down

0 comments on commit 36c100c

Please sign in to comment.