How to write a image from the live url into local system using rsync
up vote
0
down vote
favorite
I want to save a image or load a image which is on this example image link into my computer using rsync command into the terminal. Can anybody tell me how to save the image using terminal command? Path is:- /home/iron/go/src/
image terminal rsync
add a comment |
up vote
0
down vote
favorite
I want to save a image or load a image which is on this example image link into my computer using rsync command into the terminal. Can anybody tell me how to save the image using terminal command? Path is:- /home/iron/go/src/
image terminal rsync
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to save a image or load a image which is on this example image link into my computer using rsync command into the terminal. Can anybody tell me how to save the image using terminal command? Path is:- /home/iron/go/src/
image terminal rsync
I want to save a image or load a image which is on this example image link into my computer using rsync command into the terminal. Can anybody tell me how to save the image using terminal command? Path is:- /home/iron/go/src/
image terminal rsync
image terminal rsync
asked Nov 19 at 9:56
user10665991
14
14
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Here I'm adding my answer to load a image from server to the local system or you can say remote machine to local machine
Here is the little code
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
url := "https://www.bookingkoala.com/wp-content/uploads/2017/03/cropped-logo.png" // your url
// don't worry about errors
response, e := http.Get(url) // getting data from the url
if e != nil || response == nil {
return
}
defer response.Body.Close()
//open a file for writing
file, err := os.Create("/home/iron/go/src/abc/sada.png") // define path and file name where you want to store the image.
if err != nil || response == nil {
// log.Fatal(err)
return
}
defer file.Close()
// Use io.Copy to just dump the response body to the file. This supports huge files
_, err = io.Copy(file, response.Body) // it will make or copy a file of the image in the link
if err != nil {
log.Fatal(err)
}
fmt.Println("Success!")
}
I think it satisfied your question.
that seems good. let me check it in my code.
– user10665991
Nov 21 at 7:00
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Here I'm adding my answer to load a image from server to the local system or you can say remote machine to local machine
Here is the little code
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
url := "https://www.bookingkoala.com/wp-content/uploads/2017/03/cropped-logo.png" // your url
// don't worry about errors
response, e := http.Get(url) // getting data from the url
if e != nil || response == nil {
return
}
defer response.Body.Close()
//open a file for writing
file, err := os.Create("/home/iron/go/src/abc/sada.png") // define path and file name where you want to store the image.
if err != nil || response == nil {
// log.Fatal(err)
return
}
defer file.Close()
// Use io.Copy to just dump the response body to the file. This supports huge files
_, err = io.Copy(file, response.Body) // it will make or copy a file of the image in the link
if err != nil {
log.Fatal(err)
}
fmt.Println("Success!")
}
I think it satisfied your question.
that seems good. let me check it in my code.
– user10665991
Nov 21 at 7:00
add a comment |
up vote
2
down vote
accepted
Here I'm adding my answer to load a image from server to the local system or you can say remote machine to local machine
Here is the little code
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
url := "https://www.bookingkoala.com/wp-content/uploads/2017/03/cropped-logo.png" // your url
// don't worry about errors
response, e := http.Get(url) // getting data from the url
if e != nil || response == nil {
return
}
defer response.Body.Close()
//open a file for writing
file, err := os.Create("/home/iron/go/src/abc/sada.png") // define path and file name where you want to store the image.
if err != nil || response == nil {
// log.Fatal(err)
return
}
defer file.Close()
// Use io.Copy to just dump the response body to the file. This supports huge files
_, err = io.Copy(file, response.Body) // it will make or copy a file of the image in the link
if err != nil {
log.Fatal(err)
}
fmt.Println("Success!")
}
I think it satisfied your question.
that seems good. let me check it in my code.
– user10665991
Nov 21 at 7:00
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Here I'm adding my answer to load a image from server to the local system or you can say remote machine to local machine
Here is the little code
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
url := "https://www.bookingkoala.com/wp-content/uploads/2017/03/cropped-logo.png" // your url
// don't worry about errors
response, e := http.Get(url) // getting data from the url
if e != nil || response == nil {
return
}
defer response.Body.Close()
//open a file for writing
file, err := os.Create("/home/iron/go/src/abc/sada.png") // define path and file name where you want to store the image.
if err != nil || response == nil {
// log.Fatal(err)
return
}
defer file.Close()
// Use io.Copy to just dump the response body to the file. This supports huge files
_, err = io.Copy(file, response.Body) // it will make or copy a file of the image in the link
if err != nil {
log.Fatal(err)
}
fmt.Println("Success!")
}
I think it satisfied your question.
Here I'm adding my answer to load a image from server to the local system or you can say remote machine to local machine
Here is the little code
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
url := "https://www.bookingkoala.com/wp-content/uploads/2017/03/cropped-logo.png" // your url
// don't worry about errors
response, e := http.Get(url) // getting data from the url
if e != nil || response == nil {
return
}
defer response.Body.Close()
//open a file for writing
file, err := os.Create("/home/iron/go/src/abc/sada.png") // define path and file name where you want to store the image.
if err != nil || response == nil {
// log.Fatal(err)
return
}
defer file.Close()
// Use io.Copy to just dump the response body to the file. This supports huge files
_, err = io.Copy(file, response.Body) // it will make or copy a file of the image in the link
if err != nil {
log.Fatal(err)
}
fmt.Println("Success!")
}
I think it satisfied your question.
answered Nov 20 at 11:52
Puneet
642115
642115
that seems good. let me check it in my code.
– user10665991
Nov 21 at 7:00
add a comment |
that seems good. let me check it in my code.
– user10665991
Nov 21 at 7:00
that seems good. let me check it in my code.
– user10665991
Nov 21 at 7:00
that seems good. let me check it in my code.
– user10665991
Nov 21 at 7:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372121%2fhow-to-write-a-image-from-the-live-url-into-local-system-using-rsync%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown